Frequently Used DOS Commands

This handout was originally written by David Hull for use in UNCA's CSCI 126, Microcomputer Applications.

Internal Commands

ATTRIB
Changes file attributes
ATTRIB +R MYFILE -- make MYFILE read-only
ATTRIB -R MYFILE -- make MYFILE read/write
CD
Changes directory
CD \BAKER\MYFILES -- move to the MYFILES sub-directory of the BAKER directory
CD \ -- move to the root directory
CD .. -- move up to parent directory
CLS
Clears the screen
COPY
Copies files
COPY MYFILE.TXT YOURFILE.TXT
DEL
Deletes files
DEL MYFILE.LTR
DIR
Lists files of a directory
DIR -- to produce a list of files in the default directory on the default disk
DIR C:\DOS -- to produce a list of files in the DOS directory on the C: drive
Common switches are /P, pause after each screenful; /W, produce a wide listing; /OD, list in order by date; /OGNE, list in order by directory, name, & extension.
MD
Makes or create a directory
MD \ABLE
RD
Removes a directory
RD TEST
RENAME
Renames a file
RENAME MYTEST.TST MYOLD.TST
TYPE
Displays contents of a file on the screen
TYPE MYLETTER.TXT
VER
Displays the DOS version
VER
VOL
Displays the disk volume label
VOL C:

External Commands

CHKDISK
Shows disk and memory status and checks FAT table for lost allocations. Replaced by SCANDISK in version 6.2.
DEFRAG
Tunes up a disk by defragmenting files
DEFRAG A:
DELTREE
Deletes the directory, all its subdirectories, and all files in these. This is a dangerous command!
DISKCOPY
Duplicates a disk to another of the same type and size
DISKCOPY A: A:
EDIT
Starts the DOS editor for text files
EDIT MYFILE.TXT
FORMAT
Formats a disk to accept data
FORMAT A: -- formats a data diskette
FORMAT A:/S -- creates a system diskette
HELP
Help on definition and use of any DOS commands
HELP DELETE
LABEL
Changes the disk label
LABEL A:
MSBACKUP
Backs up files to and restores from one or more disks
MSBACKUP
PRINT
Prints text files
PRINT AUNTJEN.LTR
SCANDISK
Replaces CHKDSK to repair some disk problems
TREE
Displays directory structure below default directory. With the /F switch displays both directories and files.
UNDELETE
Restores files deleted with DEL. Must confirm file undeletion a file.
XCOPY
Copies files in the current directory and, with /S switch, it subdirectories. Creates new sub-directories when needed.

Some Special DOS Symbols

*
Wildcard to match multiple characters in file names
DIR *.HTM
?
Wildcard to match single characters in file names
DIR CSCI???.HTM
|
Pipe to connect the output of one program to the input of another
DIR | MORE
\
Path delimiter to separate components of a file
DIR \CSCI\FALL97\C107\INDEX.HTM
/
Switch delimiter for switches, or options, to a command
DIR /P \CSCI
>
Redirection to place output of program in a file
DIR > MYDIR.LST