Print this page

DOS Command Reference

Change the Default Drive

to change the default drive, simply type the letter of the drive
example:

- C:> A: [enter]
changes the default drive from C to A

- A:> C: [enter]
changes the default drive from A to C


CHDIR (CD) Change Directory Command

once you have located the directory you want, you may move from directory to directory using CS command(change directory)

example:
- C:> cd HUMANRESOURCE
moves you to the directory called 'HUMANRESOURCE'
- C:> cd cd \HUMANRESOURCE\MARKETING
moves you to the directory called 'MARKETING' under the directory called 'HUMANRESOURCE'
- C:> cd..
moves you up one level in the path.
- C:\ cd \
takes you back to the root directory (C: in this case)

COPY Command

copy command can be used both to copy files from disk to disk or to create a second copy of a file on a single disk.

example:
- C:> copy c:\homework.doc a:
copies the file 'homework.doc' from the C drive to A drive and gives it the same name.
- C:\ copy a:\homework.doc b:\backup\homework2.doc
copies the file 'homework.doc' from the drive A on drive B, putting it in to the 'backup' subdirectory and renaming it 'homework2.doc'

DIR (Directory) Command

The DIRECTORY command lists the names and sizes of all files located on a particular disk.

Example:

- C:> dir a:
Shows directory of drive A
- C:> dir b:
Shows directory of drive B
- C:> dir \agis
Shows files in a subdirectory on drive C (default)
- C:> dir
Shows directory of drive C
- C:> dir /w
Shows directory in wide format, as opposed to a vertical listing.

All the files are listed at the screen, you can stop the display by typing CTRL-BREAK. If you ask for a directory on the A or B drives, be sure there is a diskette in the drive and that the diskette has been formatted. If the drive is empty, or if the diskette is unformatted, the DOS will respond with an error message.

DIR Options

Two little characters, '*' and '?', will make your life with computers much easier. Their use is illustrated below.

Example:

- C:> dir a:*.ex
Lists all files on the A drive with an extension of 'EXE'.

- C:> dir b:kermit.*
Lists all files on the B drive with a filename of 'KERMIT'.

The asterisk is a wild-card character which allows the user to enter only a limited part of a file specification to find a file. It is useful when you wish to locate a group of files with the same filename or the same extension. On other occasions you may have forgotten part of a file specification. You can use '*' in place of the parts of the specification you have forgotten. Similarly, '?' permits wild-card searches keyed to single characters.

Example:

- C:> dir a:labe?.com
Lists all five-letter files with the first four letters 'LABE' and an extension of 'COM'.

- C:> dir b:format.c??
Lists all files with a filename of 'FORMAT' and an extension beginning with 'C'.

Wild-card characters can be used in combination.

Example:

- C:> dir a:labe?.*
Lists all five-letter files with the first four letters 'LABE' and any extension.

- C:> dir c:*.ex?
Lists all files with an extension beginning with 'EX'.

Experiment with '*' and '?' to improve your ability to find files quickly. These wild-card characters can also be used with several other DOS commands.

ERASE Command

The ERASE command deletes specified files.

Example:

- C:> erase a:myfile.txt

- Erases the file MYFILE.TXT from the diskette in the A drive. If no drive specification is entered, the system looks to delete the specified file form drive C: (in this case).

FORMAT Command

 

- C:> format a:
Formats the diskette in the A drive.
- C:> format b:


MKDIR (MD) Make Directory Command

This command creates a new directory.

Example:

- C:> mkdir mine
Creates a directory called 'MINE'

Rebooting the computer (Ctrl-Alt-Del)

RENAME (REN) Command

The RENAME command permits users to change the name of a file without making a copy of it.

Example:

- C:> ren a:goofy.txt pluto.txt
Changes the name of 'GOOFY.TXT' on the A drive to 'PLUTO.TXT'.

RMDIR (RD) Remove Directory Command

This command removes a directory. It is only possible to execute this command if the directory you wish to remove is empty.

Example:

- C:> rd mine
Removes directory called 'MINE'.

Stop Execution (Ctrl-Break)


Previous page: Unix Commands Reference
Next page: t1