An MS_DOS file is identified by a file name and an extension, and (optionally) a drive name:
d:filename.ext
Most commands that specify a filename can also have a path to a filename. A file can be in the root directory or a sub-directory. A \ and the directoryname is the path to the file. The drive name precedes the path and the path precedes the filename.
The drive name is optional when the file is on the default drive. An initial backslash always indicates the root directory. The directory name is optional when the file is in the current working directory of the specified drive.
Wild-card characters can be used in any combination.
Batch files contain "batches of commands and have the extension .BAT. You process the commands in a batch file by typing its filename, followed by any command parameter (switches) you want:
MS-DOS automatically processes the commands in the AUTOEXEC>BAT and CONFIG.BAT files (if present) each time the operating system loads into memory.
When you enter any internal command it executes immediately, so long as COMMAND.COM (the command processor) is in memory.
| COMMAND |
WHAT IT DOES |
| BREAK |
Display ALT-C interrupt status (ON or OFF) |
| BREAK ON |
Allow ALT-C interrupt anytime |
| BREAK OFF |
Allow ALT-C interrupt during keyboard operation |
| CAUX device |
Select the named device driver for auxiliary input/output |
| CAUX AUX |
Reinstate standard device driver for auxiliary device |
| CHDIR [ d: ] |
Display name of the current directory on default drive or select drive. Can be abbreviated to CD |
| CHDIR [ \ ] dir name |
Change working directory to the last subdirectory named in the path |
| CD .. |
Change working directory to parent directory |
| CD / A |
Display names of working directories on all drives |
| CLST device |
Select the named device driver for the list device input/output |
| CLST SERIALA |
Select serial port A for output for list device (printer) |
| CLS |
Clear the CRT screen |
| COPY d:filespec |
Copy file from named device onto default drive |
| COPY filespec1 filespec2 |
Copy first file to second file |
| COPY filespec1 + filespec2 filespec3 |
Copy first and second files into third |
| COPY filespec1/b + filespec2/a filespec3/b |
Copy first binary and second ASCII files into third binary file |
| COPY filespec1/a filespec2 |
Copy first file up to the first embedded ^Z into second file |
| COPY *.ext filespec |
Copy first file group into second file |
| COPY *.ex1 + *.ex2 *.ex3 |
Copy matching files from first and second file groups into third file group |
| CTTY |
Change the console input/output device |
| DATE |
Display date |
| DATE mm/dd/yy |
Set new date. (Use dd-mm-yy in Europe) |
| DEL filespec |
Delete file |
| DEL *.ext |
Delete all files with named extension |
| DEL filename.* |
Delete all files with given filename, regardless of extension |
| DEL *.* |
Delete all files in the working directory of default drive |
| DIR |
Display the current directory, default drive |
| DIR d: |
Display the current directory, named drive |
| DIR d:[ \ ]directoryname... |
Display the last named subdirectory in the path on the named drive |
| DIR filespec |
Display directory entry for named file |
| DIR /P |
Stop directory display when screen is full |
| DIR /W |
Display filenames across screen width |
| ECHO |
Display setting (ON or OFF) for display of batch file commands and comments |
| ECHO ON |
Display all batch file commands and comments |
| ECHO OFF |
Stop display of batch file commands and comments |
| ERASE filespec |
Erase (delete) the named file. Same as DEL command |
| EXIT |
Return from an invoked COMMAND.COM to previous program |
| FOR %%variable in (set) do MS-DOS command %%variable |
For each member in "(set)" do the MS-DOS command |
| GOTO label |
Continue batch processing with the next command below the specified label |
| HISTORY |
Display command history. (Can also be HI) |
| HI n |
Re-enter command n from history into command-line template |
IF string1 = = string2 MS-DOS command |
If the condition is TRUE (equal), process the MS-DOS command. Batch file command only |
| IF [ not ] exist filespec MS-DOS command |
Look for specified file. Process MS-DOS command if file exists, or when, "if not" is TRUE. Batch file command only |
| IF errorlevel n MS-DOS command |
Check for specified errorlevel number (n). Process MS-DOS command if previous program exit code n is the same or higher than n. Batch file command only |
| IF not errorlevel n MS-DOS command |
When previous exit code is less than n, process MS-DOS command. Batch file command only |
| MKDIR [d:][ \] directoryname... |
Make new sub-directory in the current directory or in the last directory in the specified path. (Can also be MD) |
| PATH |
Display the current path (Location of command and batch files) |
| PATH; |
Search only the current directory for command and batch files |
PATH [d:][ \] directoryname... [;[d:][\] directoryname...] |
Search for command or batch files in the specified sub-directory or sub-directories |
| PAUSE |
Pause or stop batch file processing |
| PAUSE comment |
Display comment during pause in batch file processing |
| PROMPT |
Use the MS-DOS default prompt |
| PROMPT prompt text |
Change default MS-DOS prompt to specified alphanumeric characters (prompt text) |
| REM comment |
Display the specified characters (comment) during batch file processing |
| RMDIR [d:][\] directoryname... |
Remove the specified directory name from the current directory or from the last directory in the path. (Can also be RD) |
| REN filespec filespec |
Rename the first file with the second file name |
| SHIFT |
Move all replaceable parameters one position to the left. (%0 < %1 < %2....%9 < next parameter) |
| SYS source destination |
Copy operating system and support files from source drive to designated drive. Source must be an existing system or system configuration file.Use /O to copy only MS-DOS.SYS |
| TIME |
Display time |
| TIME hh:mm |
Set time (hours and minutes) |
| TYPE filespec |
Display the named file |
| VER |
Display current version of MS-DOS |
| VERIFY |
Display current setting (ON or OFF) of verify |
| VERIFY ON |
Verify any data written to disk |
| VERIFY OFF |
Do not verify data written to disk |
| VOL |
Display mane of volume in default drive |
| VOL d: /C |
Display name of volume in named drive and prompt for a new Volume ID |
External commands are programs stored in disk files. When you enter an external command, the program loads from disk before it can execute.
| COMMAND |
WHAT IT DOES |
| CHKDSK |
Make consistency check on default drive. Display errors (lost clusters and chains) and prompt for converting lost chains to files (status report) |
| CHKDSK d: |
Check directory of named drive and display status report |
| CHKDSK /F |
Automatically correct errors |
| CHKDSK /V |
Display trace of files and directories |
| CHKDSK filespec |
Report extents for named files in current directory after normal consistency check |
| COMMAND |
Reload COMMAND.COM |
| CONCAT filespec |
Display contents of named file(s) |
| CONCAT directoryname |
Concatenate all files in the named sub-directory and display the results |
| DISKCOPY |
Load DISKCOPY program |
| DISKCOPY LEFT TO RIGHT |
Copy contents of disk in left drive to disk in right drive |
| DISKCOPY R to L /E /Z |
Copy contents of right drive to left drive; display number and location of soft errors, and zone information |
| FILCOM file1 file2 |
Compare file1 with file2 on a line-by-line basis and display the differences between the files |
| FILECOM file1 file2 /B /# |
Compare file1 with file2 on a byte-by-byte basis with # (number) lines required to match |
| FILECOM file1 file2 /C /W |
Compare file1 with file2 on a line-by-line basis, ignoring the case of letters, and compressing white spaces |
| FGREP "a string" filespec... directoryname... |
Search all named files and all named sub-directories. Output filenames and all lines that contain "a string" |
| FGREP /RVCI string filespec... directoryname... |
Search all named files and all named sub-directories and recursively search (/R) any sub-directories below. Print only a count (/C) of the lines that do not contain (/V) the string, ignoring upper/lowercase (/I) |
| FIND "string" |
Filter to search the displayed lines for the specified string and display all lines containing the string |
| FIND /C "string" |
Display the relative number of the lines that contain the specified string |
| FIND /N "string" |
Display only the lines that contain the specified string |
| FIND /V "string" |
Display the lines that do not contain the specified string |
| FIND "string" filespec |
Display the lines from the named file that contain the specified string |
| FORMAT |
Load the FORMAT program to prepare a diskette to receive data |
| FORMAT side /D /C /Z |
FORMAT the diskette on the named side of the machine (left or right); do double-sided format; display number of soft errors, and zone information |
| LS /LRE |
List the directory of the default drive in long format (/L), with recursive searching of all sub-directories below current directory (/R), in order by extension (/E) |
| LS d: /BT |
List the directory of the named drive with files sorted backwards (/B) according to file date and time |
| MODCON source savefile |
Set source as active keyboard and/or character set. Save current keyboard and/or character set as savefile |
| MODCON * savefile |
Save the current character set and/or keyboard file as savefile. Do not change the active keyboard or character set |
| MORE |
Filter to display one screen of data at a time, until a key is pressed |
| MV filespec file2 |
Move the named file into the second file and delete the original file |
| MV filespec directoryname |
Move the original named file into the named directory and delete the original file |
| PORTSET HELP |
Display help about portset utility |
| PORTSET A 300 EVEN 1 6 |
Set serial port A to 300 baud rate, even parity, 1 stop bit, and 6 bits per character |
| PORTSET B 1200 |
Set serial port B to 1200 baud rate. Leave other settings unchanged |
| PRINT |
Display the names of the files in the print queue |
| PRINT d: |
Put the file(s) from the named drive current directory into the print queue |
| PRINT d:filename.ext |
Queue and print the named file(s) |
| PRINT /C |
Cancel the queued files for printing |
Print filename1/P filename2 filename3/C filename4 |
Print the first and second file.
Cancel the third file in the print queue. Print the fourth file. /P is the default |
| RDCPM d:filename.ext |
Transfer named CP/M file to default drive |
| RDCPM d:*.ext |
Transfer all CP/M files with named extension on named drive to default drive |
d:/directoryname... RDCPM d:filename.ext |
Transfer named CP/M file to named drive and sub-directory (First named drive contains the MS-DOS disk) |
| RDCPM DIR d: |
Display directory of CP/M disk in named drive |
| RDCPM DIR d:filename.ext |
Display directory entry of named CP/M file |
| RECOVER filespec |
Recover the named file from a defective disk |
| RECOVER d: |
Recover all files from a defective disk |
| SDCOPY |
Load the SDCOPY program to copy the contents of one diskette to another formatted diskette using a single floppy drive |
| SDCOPY d: |
Copy the contents of the diskette in the named drive to another formatted diskette using the same drive |
| SEARCH files constraints actions |
Search the named files and/or directories for the files that meet the matching constraints. Perform the named actions on the matching files |
| SET |
Display all current SET values |
| SET string1 = string2 |
Set string1 equivalent to string2. MS-DOS uses string2 in place of string1 in subsequent operations |
| SORT |
Rearrange data alphanumerically |
| SORT /R |
Reverse the alphanumerical sort (z to a, or N to 0) |
| SORT / + n |
Sort the data by the specified numerical column |
| SORT /R / + n |
Reverse the numerical column sort |
| SORT <[d:]input source >[d:] output source |
Sort data from disk file or device alphanumerically and send the sorted data to a file, printer or other device |
| TAIL /n directoryname |
Display the last n lines of the files in the named directory |
| TAIL filespec |
Display the last 10 lines of the named file(s) |
| WC directoryname /R |
Count the words and lines in all files in the named directory, including any sub-directories (/R) |
| WC filespec /W |
Count the lines only (/W) in the named file(s) |
The top row of function keys on the keyboard are used for ediditing the MS-DOS command line template and the EDLIN edit line template. Function keys are preceded by F (for example, Function key 1 is F1).