List of DOS commands

This article presents a list of commands used by x86 DOS operating systems. Other DOS operating systems are not part of the scope of this list.
In the PC operating systems MS-DOS and PC DOS, a number of standard system commands were provided for common tasks such as listing files on a disk or moving files. Some commands were built into the command interpreter, others existed as external commands on disk. Over the several generations of DOS, commands were added for the additional functions of the operating system. In the current Microsoft Windows operating system a text-mode command prompt window can still be used.

Command processing

The command interpreter for DOS runs when no application programs are running. When an application exits, if the transient portion of the command interpreter in memory was overwritten, DOS will reload it from disk. Some commands are internal and built into COMMAND.COM, others are external commands stored on disk. When the user types a line of text at the operating system command prompt, COMMAND.COM will parse the line and attempt to match a command name to a built-in command or to the name of an executable program file or batch file on disk. If no match is found, an error message is printed and the command prompt is refreshed.

ACALC

External - PC DOS 7
Calculates the value of a mathematical expression.
ACALC [/T[:]format] expression

  /T           Specifies the output format type
  format         D=Decimal (default)   B=Binary   O=Octal   X=heXadecimal
                 A=All (decimal, binary, octal, and hexadecimal)
  expression   Specifies a valid numeric expression.

Numbers prefixed with 'b', 'o', and 'x' are assumed to be binary, octal,
and hexadecimal respectively.  Decimal numbers are not prefixed.

APPEND

External - DOS 3.3 and above
Allows programs to open data files in specified directories as if they were in the current directory.
APPEND [[drive:]path[;...]] [/X[:ON | :OFF]] [/PATH:ON | /PATH:OFF] [/E]
APPEND ;

  [drive:]path Specifies a drive and directory to append.
  /X:ON        Applies appended directories to file searches and
               application execution.
  /X:OFF       Applies appended directories only to requests to open files.
               /X:OFF is the default setting.
  /PATH:ON     Applies appended directories to file requests that already
               specify a path.  /PATH:ON is the default setting.
  /PATH:OFF    Turns off the effect of /PATH:ON.
  /E           Stores a copy of the appended directory list in an environment
               variable named APPEND.  /E may be used only the first time
               you use APPEND after starting your system.

Type APPEND ; to clear the appended directory list.
Type APPEND without parameters to display the appended directory list.

ASSIGN

External - DOS 2.0 and above
Further information: Drive letter assignment
Redirects requests for disk operations on one drive to a different drive.
ASSIGN [x[:]=y[:][...]]
ASSIGN /STATUS

  x        Specifies the drive letter to reassign.
  y        Specifies the drive that x: will be assigned to.
  /STATUS  Displays current drive assignments.

Type ASSIGN without parameters to reset all drive letters to original
assignments.

ATTRIB

External - DOS 3.0 and above
Displays or changes file attributes.
ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [[drive:][path]filename] [/S]

  +   Sets an attribute.
  -   Clears an attribute.
  R   Read-only file attribute.
  A   Archive file attribute.
  S   System file attribute.
  H   Hidden file attribute.
  /S  Processes files in all directories in the specified path.
+S, -S, +H, and -H are available in DOS 5.0 and above.

BACKUP

External - DOS 2.0 and above
Backs up one or more files from one disk to another.
BACKUP source destination-drive: [/S] [/M] [/A] [/F[:size]]
  [/D:date[/T:time]] [/L[:[drive:][path]logfile]]

  source             Specifies the file(s), drive, or directory to back up.
  destination-drive: Specifies the drive to save backup copies onto.
  /S                 Backs up contents of subdirectories.
  /M                 Backs up only files that have changed since the last
                     backup.
  /A                 Adds backup files to an existing backup disk.
  /F:[size]          Specifies the size of the disk to be formatted.
  /D:date            Backs up only files changed on or after the specified
                     date.
  /T:time            Backs up only files changed at or after the specified
                     time.
  /L[:[drive:][path]logfile]
                     Creates a log file and entry to record the backup
                     operation.

BASIC, BASICA and GWBASIC

External - DOS 1.0 to DOS 4.0
An implementation of the BASIC programming language for PCs.
IBM computers had Cassette BASIC in ROM; BASIC (Disk BASIC) and BASICA (Advanced BASIC) were extensions to the ROM-based Cassette BASIC.
Microsoft released GW-BASIC for IBM compatible PCs which did not have ROM BASIC. GW-BASIC was a complete BASIC interpreter which was compatible with BASICA. Some OEM releases had BASIC.COM and BASICA.COM as loaders for GWBASIC.EXE. MS-DOS 5.0 and higher included QBasic instead of GW-BASIC.

BREAK

Internal - DOS 2.0 and above
Sets or clears extended CTRL+C checking.
BREAK [ON | OFF]

Type BREAK without a parameter to display the current BREAK setting.

CALL

Internal - DOS 3.3 and above
Calls one batch program from another.
CALL [drive:][path]filename [batch-parameters]

  batch-parameters   Specifies any command-line information required by the
                     batch program.

CHCP

Internal - DOS 3.3 and above
Displays or sets the active code page number.
CHCP [nnn]

  nnn   Specifies a code page number.

Type CHCP without a parameter to display the active code page number.

CHDIR or CD

Internal - DOS 2.0 and above
Displays the name of or changes the current directory.
CHDIR [drive:][path]
CHDIR[..]
CD [drive:][path]
CD[..]

  ..   Specifies that you want to change to the parent directory.

Type CD drive: to display the current directory in the specified drive.
Type CD without parameters to display the current drive and directory.

CHKDSK

External - DOS 1.0 and above
Checks a disk and displays a status report.
CHKDSK [drive:][[path]filename] [/F] [/V]

  [drive:][path]  Specifies the drive and directory to check.
  filename        Specifies the file(s) to check for fragmentation.
  /F              Fixes errors on the disk.
  /V              Displays the full path and name of every file on the disk.

Type CHKDSK without parameters to check the current disk.
CHKDSK originated as an external command in 86-DOS.

CHOICE

External - DOS 6.0 and above
Waits for you to choose one of a set of choices.
CHOICE [/C[:]choices] [/N] [/S] [/T[:]c,nn] [text]

/C[:]choices Specifies allowable keys. Default is YN.
/N           Does not display choices and ? at end of prompt string.
/S           Treats choice keys as case sensitive.
/T[:]c,nn    Defaults choice to c after <nn> seconds.
text         Prompts string to display.

ERRORLEVEL is set to offset of key you press in choices.

CIPHER

External - some issues of MS-DOS 2.xx only
Encrypts and decrypts data.
CIPHER key
CIPHER encrypts the data read from standard input using the provided key and sends it to standard output. To decrypt, the data needs to be passed through CIPHER again using the same key.

COMMAND

External - DOS 1.0 and above
Starts a new copy of the DOS Command Interpreter.
COMMAND [[drive:]path] [device] [/E:nnnnn] [/P [/MSG]]
        [/H] [/O] [/Y [/C command | /K command]]

  [drive:]path    Specifies the directory containing COMMAND.COM file.
  device          Specifies the device to use for command input and output.
  /E:nnnnn        Sets the initial environment size to nnnnn bytes.
  /P              Makes the new Command Interpreter permanent (can't exit).
  /MSG            Stores all error messages in memory (requires /P).
  /H              Loads the Command Interpreter into a UMB if available.
  /O              Disables overwrite prompt on COPY,XCOPY,and MOVE commands.
  /Y              Steps through the batch program specified by /C or /K.
  /C command      Executes the specified command and returns.
  /K command      Executes the specified command and continues running.

The /P and /MSG switches may be used only when COMMAND is started by using
the SHELL command in the CONFIG.SYS file.
/O and /Y are only available in DOS 6 and above. /H is only available in PC DOS 7.
COMMAND.COM originated in 86-DOS.

GOTO

Internal - DOS 2.0 and above
Directs DOS to a labelled line in a batch program.
GOTO label

  label   Specifies a text string used in the batch program as a label.

You type a label on a line by itself, beginning with a colon.

FORMAT

External - DOS 1.0 and above
Formats a disk for use with DOS.
FORMAT drive: [/V[:label]] [/Q] [/U] [/F:size] [/B | /S] [/C] FORMAT drive: [/V[:label]] [/Q] [/U] [/T:tracks /N:sectors] [/B | /S] [/C] FORMAT drive: [/V[:label]] [/Q] [/U] [/1] [/4] [/B | /S] [/C] FORMAT drive: [/Q] [/U] [/1] [/4] [/8] [/B | /S] [/C] /V[:label] Specifies the volume label. /Q Performs a quick format. /U Performs an unconditional format. /F:size Specifies the size of the floppy disk to format (such as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88). /B Allocates space on the formatted disk for system files. /S Copies system files to the formatted disk. /T:tracks Specifies the number of tracks per disk side. /N:sectors Specifies the number of sectors per track. /1 Formats a single side of a floppy disk. /4 Formats a 5.25-inch 360K floppy disk in a high-density drive. /8 Formats eight sectors per track. /C Revert to less conservative handling of bad blocks. /Q and /U are only available in DOS 5 and above. /C is only available in DOS 6 and above.
FORMAT replaced the internal command CLEAR in 86-DOS.

FOR

Internal - DOS 2.0 and above
Runs a specified command for each file in a set of files.
FOR [drive:\][directory] %variable IN (set) DO command [command-parameters]

  %variable  Specifies a replaceable parameter.
  (set)      Specifies a set of one or more files.  Wildcards may be used.
  command    Specifies the command to carry out for each file.
  command-parameters
             Specifies parameters or switches for the specified command.

To use the FOR command in a batch program, specify %%variable instead of
%variable

POWER

External - DOS 5.02 and above
Controls power management.
POWER [ADV[:MAX | REG | MIN] | STD | OFF] ADV[:MAX | REG | MIN] -- Reduces power by monitoring applications and hardware devices. MAX provides the most power conservation, REG provides average power conservation, and MIN provides the least conservation. STD -- Reduces power by monitoring hardware devices. OFF -- Turns off power management. POWER.EXE must be loaded as a device driver in CONFIG.SYS in order to use this command.

REPLACE

External - DOS 3.2 and above
Replaces files.
REPLACE [drive1:][path1]filename [drive2:][path2] [/A] [/P] [/R] [/W]
REPLACE [drive1:][path1]filename [drive2:][path2] [/P] [/R] [/S] [/W] [/U]

  [drive1:][path1]filename Specifies the source file or files.
  [drive2:][path2]         Specifies the directory where files are to be
                           replaced.
  /A                       Adds new files to destination directory. Cannot
                           use with /S or /U switches.
  /P                       Prompts for confirmation before replacing a file or
                           adding a source file.
  /R                       Replaces read-only files as well as unprotected
                           files.
  /S                       Replaces files in all subdirectories of the
                           destination directory. Cannot use with the /A
                           switch.
  /W                       Waits for you to insert a disk before beginning.
  /U                       Replaces (updates) only files that are older than
                           source files. Cannot use with the /A switch.

DEBUG

External - DOS 1.0 and above
Runs Debug, a program testing and editing tool.
DEBUG [[drive:][path]filename [testfile-parameters]] [drive:][path]filename Specifies the file you want to test. testfile-parameters Specifies command-line information required by the file you want to test. After Debug starts, type ? to display a list of debugging commands.

COPY

Internal - DOS 1.0 and above
Copies one or more files to another location.
COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination
  [/A | /B]] [/V] [/Y | /-Y]

  source       Specifies the file or files to be copied. The source can
               also be a device (e.g., CON for console).
  /A           Indicates an ASCII text file.
  /B           Indicates a binary file.
  destination  Specifies the directory and/or file name for the new file(s).
  /V           Verifies that new files are written correctly.
  /Y           Suppresses prompting to confirm you want to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.

The switch /Y may be preset in the COPYCMD environment variable.
To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format).
/Y and /-Y are only available in DOS 6 and above.
COPY originated as an internal command in 86-DOS.

CTTY

Internal - DOS 2.0 and above
Changes the terminal device used to control your system.
CTTY device

  device   The terminal device you want to use, such as COM1.

DATE

External - DOS 1.0
Internal - DOS 1.1 and above
Displays or sets the date.
DATE [date]

Type DATE without parameters to display the current date setting and
a prompt for a new one.  Press ENTER to keep the same date.