Jan's Illustrated Computer Literacy 101 Logo:Jegsworks Jan's Illustrated Computer Literacy 101

Home > Jan's CompLit 101 > Computer Basics > Appendix : DOS Commands

Jan's Computer Basics:

Appendix: DOS Commands

When your pretty graphical interface breaks, you may have to go to the command line to fix it. Even within Windows, it can be faster to type a command on the Run line than to find the right icon to start a program. So a knowledge of DOS commands is not yet useless.

DOS command window = Debug

(You may need to use your browser's Back button to return to the page that sent you here.)

DOS or Command Line Interface

The user interface with the DOS operating system or a command line interface is very simple. You type commands line-by-line on an undecorated computer screen. All that you see to start with is a simple designation of what directory you are in, like MS-DOS iconfor the normal root directory. 

Where you type is called the command line.

What to type (Useful DOS commands):

Command / Description Example

d: (for example)
Type the letter of the drive and a colon and press ENTER to change to the named drive.


Lists the contents of directory,
giving for each file, the filename and extension, then the file's size in bytes, then the file's date and time of creation.
Last two lines give the total number of files in this directory, the total of the file sizes, and the amount of space still free on the current drive. If the directory contains subdirectories, they will be listed, too.

Volume in drive C has no label
Volume Serial Number is 0FFD-1D51
Directory of C:\mydocs
. <DIR> 09-26-96  9:36a
.. <DIR> 09-26-96  936a
memo txt 110 10-24-97  8:45a
letter~1 doc 2504 12-31-96  7:32p
letter~2 doc 4534 01-15-97 10:35a
    3 file(s) 7148 bytes
    2 dir(s) 37,830,656,bytes free

md dirname
Makes a directory nested inside the current directory. The example makes a directory inside mydocs because that is current directory, as is shown on the command line.

C:\mydocs>md mydrctry

rd dirname
Removes an empty directory. Note that you can't remove a directory that is the current one. You're standing in it! Also, you'll have to delete all the documents inside the directory before you can remove the directory.

C:\>rd c:\mydocs\mydrctry

cd dirname
Changes to a new directory. Note the new current directory on the command line.

C:\windows>cd c:\mydocs\mydrctry

del filename
Delete a file. The example deletes a file from a different drive and directory. If the file is in the current directory, you don't have to give the full path.

C:\>del d:\worddocs\letter.doc

del *.*
User WarningThis command deletes everything in the current directory. This is second only to the format command for dangerousness! DO NOT USE this command unless you are very, very sure of what directory it will be applied to! Getting in a hurry with del can lead to a whole lot of grief. The example on the right will delete ALL files from the directory mydocs. If the current directory is the root of a drive, the entire drive will be erased. Whoops!!

C:\mydocs>del *.*

copy pathtofile newpathtofile         Copies file named first to location named second.
C:\>copy c:\mydocs\mydrctry\letter~1.doc d:\worddocs

move filename         Moves a file to a new location.
Looks just like "copy" above except for the word "move".

ren filename newname
Renames file with first name to second name. You must include the full path to the original file if it's not in the current directory.
C:\>ren oldfile.exe newfile.exe
C:\>ren c:\mydocs\myletter.doc letter1.doc

edit filename
Brings up the DOS Edit program so you can make changes in a text file. This is a very simple text editor and won't work with regular word processing documents. It is useful, though, for editing some of the files that manage the startup of your computer. When things go wrong at a basic level, you sometimes need Edit to fix them.

C:\>edit c:\autoexec.bat >

type filename
If you want to just look at a text file, this command will display it on the monitor. But if it has many lines, you'll have to be quick to press the Pause key or the top of the file will scroll out of view before you can read it.

C:\>type c:\autoexec.bat

format drive
User Warning format is the most dangerous of all, since you can erase your hard drive with it. Use it only on floppy drives A and B, or when you really, really, really know what you are doing. Don't forget- formatting a disk erases the contents!

C:\>format a:

User WarningUnder ANY operating system, you can get yourself into serious trouble by renaming, moving, or deleting files when you don't know exactly what you are doing.

More on DOS Commands at ComputerHope.com

Download a complete list of DOS commands: doshelp.zip

(Use your Back button to return to the page that sent you here or use the menu or crumbs to pick another page to view.)