DOS/Command Prompt Reference
This page includes command references for MS-DOS Prompt and Windows Command Prompt. Some command references have samples for the prompt and the batch files.
Command list
Currently only a few command references are available in English. More references are available in Japanese here: DOS/コマンドプロンプト コマンド一覧
Notes
- On this site, ‘Windows NT series’ means Windows NT/2000/XP or later environments or ‘cmd.exe’ environments (Not all Windows versions are researched). ‘command.com’ environment may be differ from ‘cmd.exe’ environment.
- Commands/Programs
Call Executes a batch program from a batch program without terminating. Or executes subroutines. Cd Changes the current directory. Chcp Displays/changes the code page for the current session. Chdir Changes the current directory. Cls Clears all output in the screen. Copy Copies the file(s). Date Displays and changes the system date. Echo Outputs text to the screen. Also toggles prompt display. Endlocal Ends localization of environment changes. Exit Exits the prompt. Find Searches for the string from the file. For Executes a command for each files or texts matching with the specified pattern. If Executes a command when specified condition is met. More Displays the long output per screen. Move Moves the file(s). Pause Stops (pauses) the execution and prompts for any key input. Popd Restores Pushd's directory change just before. Pushd Changes the current directory. The current directory can be restored by calling Popd. Prompt Sets/changes the prompt display. Rem Does nothing. Used for writing comments in batch files. Ren Changes the name of the file. Rename Changes the name of the file. Set Displays or modifies environment variables. Setlocal Begins localization of environment changes, making environment variable changes or etc. temporary. Shift Shifts parameters, specified to the batch program, and enables to use 10 or more parameters. Sort Sorts each line of input data and prints the result. Time Displays and changes the system time setting. Type Outputs the file content. Verify Sets whether to verify writing a file to a disk. * Command is an internal command, Command is an external command (program).
* Command is treated as an internal command only in Command Prompt and batch files running under Command Prompt environments.
- Pipe/Redirection symbols
| [Pipe] Passes the output of the left command as input to the right command. < [Input redirection] Passes specified file contents as input to the command. > [Output redirection] Writes the output of the command to the specified file. >> [Append redirection] Appends the output of the command to the specified file.
- Special characters / Device file name etc.
@ Suppresses echo-back of commands in batch files. : Defines a label in batch files. ; Used to write comments in Config.sys file. % Used to retrieve values of environment variables and batch program parameters. ! Used for the delayed environment variable expansion. ^ Treats the following character as a regular character. Or treats multiple lines as one-line command line. & Executes two or more commands in a row. || Used to execute the another command when the command fails. && Used to execute the another command when the command succeeds. ( ) Treats multiple commands like one command. CON A device file of ‘console’. NUL A device file of ‘an empty file’ AUX A device file used to communicate with the device through the default serial port. COMn A device file used to communicate with the device through the serial port corresponding to the specified number. PRN A device file used to communicate with the device (printer) through the default parallel port. LPTn A device file used to communicate with the device through the parallel port corresponding to the specified number.