This page is divided into two sections, INTERNAL and EXTERNAL MS-DOS commands. Internal commands executed directly by code found in COMMAND.COM, while external commands are located in files.
External command files are usually located in the C:\WINDOWS\COMMAND\ folder and can be found using DIR. As with internal commands, external commands display a brief summary of their operation and expected parameters if the command is entered followed by /? or, in a few cases, /help.
Since DOS internal commands are more difficult to discover, I've created this page to assist users in learning about them. The external commands were appended to complete the list. I've also sprinkled a few environment variables and .BAT file operatives among the commands.
The numbered links point to my posts on the COMPUTER LEARNING tread of Silicon Investor where one may review the disussion and find supplementary information along with other viewpoints and opinions. See Posts for a more links to my SI posts.
This page was written with the DOS that comes with Windows 98 in mind.
@ disables command echo. One common use is in .BAT files to supress the command display during execution. See ECHO
Example: @ECHO OFF
TopAUTOEXEC.BAT is a batch file that will execute whenever the system boots. All DOS commands available for .BAT files are acceptable. See 14132028 and 16015262
Note: AUTOEXEC.BAT must be put in the root directory of the bootable drive.
TopBATCH is not a DOS command.
Batch files, with the .BAT extension, are text files containing DOS commands. They are executed similarly to programs: from the DOS command line; Windows Start/Run; or through a Windows shortcut. See (@), AutoExec, Call, ClearScr, ECHO, Exit, For, GoTo, IF, Label, NUL, Pause, Remark, Shift, and 16015262
TopBOOT is not a DOS command. Boot is a computer operation getting its name from the saying "To pull yourself up by the bootstraps." To boot, a computer executes just enough ROM code to read a disk. This disk contains sufficient code to perform all the work necessary for the system to start.
Early Windows machines first boot DOS, then load Windows code. Windows NT and Windows 2000 boot directly without first loading DOS.
See 15654080
TopBREAK ON tells DOS to check for the user pressing the BREAK key periodically, even if the program is busy. BREAK OFF will tell DOS to only check for user keypresses when the program expects user input.
Type BREAK without parameters to determine current BREAK setting.
Example: BREAK OFF
TopThe CALL command is used in a .BAT file to execute another .BAT file. When the CALLed .BAT file terminates, the CALLing .BAT file resumes execution. When secondary .BAT file is executed from within a .BAT file, the termination of the secondary .BAT file also terminates the execution of the original .BAT file too.
The CALL command can take parameters to be passed to the called file.
Example: CALL ANOTHER.BAT
TopCD, or Change Directory, sets the default directory. CD .. (double periods) will change to the parent directory.
CD is identical to CHDIR.
Example: CD \WINDOWS\COMMAND
TopCHCP, or Change Code Page will activate a new code page. CHCP without parameters will display the current code page.
TopCHDIR, or Change Directory, sets the default directory. CHDIR .. (double periods) will change to the parent directory.
CHDIR is identical to CD.
Example: CHDIR ..
TopCLS, or Clear Screen will blank the screen and put the cursor in the upper left corner following the command prompt. Although CLS is commonly used in .BAT files, the CLS command will work if typed from the keyboard.
TopCMDLINE is an environment variable value made available to programs. Although it isn't a DOS command, it is included here because COMMAND.COM processes it. Most users can disregard it, which I recommend they do.
TopCOMMAND is the program which processes instructions entered by users. Several parameters are possible. (/E: /L: /U: /P /MSG /LOW /Y /C /K) Type COMMAND /? for an explanation of what they are and how they're used.
Example: COMMAND /C DIR
TopCOMSPEC is an environment variable taking the string value of the location of the command interpreter. It is used whenever a replacement command interpreter is provided, or when COMMAND.COM is located other than in the root directory of the boot drive. Type SET to examine the current value of COMSPEC. (COMSPEC is not a command.)
Example: SET COMSPEC=C:\COMMAND.COM
TopThe COPY command copies data. Although most often used to copy files, COPY can also copy data between devices. (Example: COPY CON: PRN: would make a computer act somewhat like a typewriter.) COPY can work with multiple files. COPY can append files. Type COPY /? for more information.
COPY can be controlled by the setting of the COPYCMD environment variable.
Example: COPY C:SOURCE.DAT D:DESTIN.DAT
TopCTTY enables the system to be controlled by a terminal. Few will find this command useful.
TopDATE sets the system date. Type DATE, and the system will prompt for a new date. If no new date is provided, the system date remains unchanged.
Example: DATE 06-19-01
TopDEL deletes files. DEL /P will prompt before deletion. The DEL command is identical to ERASE.
Example: DEL C:\USELESS.JNK
TopDIR displays a list of the files in a directory. DIR action can be modified by /P,/W,/A,/O,/S,/B,/L,/V,/4. Type DIR /? for a description of DIR parameters.
DIR can be controlled by the setting of the DIRCMD environment variable.
(I use SET DIRCMD=/OGNE, (Order (Group directories first), Name, Extension)
Example: DIR C:\WINDOWS\SYSTEM\*.DLL
TopDO is a piece of the FOR ... IN ... DO command. See FOR
TopECHO is commonly used in .BAT files to control the display of text and commands. See @_Sign
ECHO can take a number of forms
ERASE deletes files. ERASE /P will prompt before deletion. The ERASE command is identical to DEL.
Example: ERASE D:\TEMPO???.JNK
TopERRORLEVEL is an environment variable where the exit code of programs is stored. Commonly, .BAT files test the value of ERRORLEVEL to determine subsequent action.
Example: IF ERRORLEVEL 3 GOTO OOPS
TopEXIST tests for the existance of a file. EXIST is typically used in .BAT files.
Example: IF EXIST FILENAME.EXT ECHO File found!
Example: IF EXIST BAD_DAT.JNK DEL BAD_DAT.JNK
TopEXIT terminates execution of COMMAND.COM, or equivalently, closes a DOS Window. Typically, EXIT terminates only copies of the command shell, and not the original.
Top
EXTENSION .BAT
EXTENSION .COM
EXTENSION .EXE
The command shell examines the file extension of commands to determine how those commands should be processed. .BAT files contain text that COMMAND.COM interprets and executes within its own code. .COM and .EXE files contain code which is first loaded into memory and then execution becomes the responsibility of that code. On termination, control is passed back to COMMAND.COM and the program resources are recovered.
Commands are given by the filename, omitting the extension. COMMAND.COM checks for .BAT files first, .COM files next, and .EXE files last.
.COM files are specialized .EXE files. Their use is being discouraged.
TopFOR %v IN (set) DO {command and its parameters} is a looping control command. It performs repetitive tasks from either the keyboard or a .BAT file.
Notes:
GOTO is a .BAT file command. GOTO causes execution of the .BAT file to jump to the label specified in the GOTO command. Labels are text tags commencing with a colon. GOTO commands are often combined with IF statements.
Example: IF NOT EXIST filename.ext GOTO Error
TopIF tests a condition in .BAT files.
Types of conditions:
Example: IF NOT "%1"=="FILENAME.EXT" TYPE FILENAME.EXT
TopIN is a piece of the FOR ... IN ... DO command. See FOR
TopLABEL in a .BAT file begins with a colon
Example:
{command}
:LABEL
{command}
LFNFOR enables or disables long file names when using FOR command. Type LFNFOR to display current status.
Example: LFNFOR ON
TopLH Loads programs into upper memory. LH is identical to LOADHIGH.
Example: LH DOSKEY C=C: $T CD \
TopLOADHIGH Loads programs into upper memory. LOADHIGH is identical to LH.
Example: LOADHIGH DOSKEY C=C: $T CD \
TopLOCK enables direct disk access. See UNLOCK and 15668587
TopMD creates a new directory or subdirectory. MD is identical to MKDIR.
Example: MD \NEW_SUB
TopMKDIR creates a new directory or subdirectory. MKDIR is identical to MD.
Example: MKDIR \NEW_SUB
TopTo the best of my knowledge, NAME isn't a DOS command, reserved word, or variable. If I ever figure out why it's here, I'll update this page. (NAME is found inside the code of COMMAND.COM)
TopNOT negates the conditional results in IF commands.
Example: IF NOT EXIST EMERGNCY.DAT COPY PRECIOUS.DAT EMERGNCY.DAT
TopNUL is a re-direction destination. It is used to re-direct unwanted output. In this example, the confirmation for the command is suppressed.
Example: LOADHIGH DOSKEY /INSERT > NUL
TopPATH is an environment variable. Path can be set by the PATH command, or using SET. Semi-colons separate paths. Multiple paths are seached beginning from the left entry.
Example:
PAUSE suspends execution, displays a "Press any key to continue..." message, and waits for a keypress. PAUSE is often used with ECHO to create user friendly prompts.
Example:
{commands}
ECHO Press Ctrl-C to abort program
PAUSE
{commands}
PROMPT is an environment variable. Prompt can be set by the PROMPT command or by using SET. Use PROMPT /? to display a list of symbols recognized by the PROMPT command. (Special symbols are required so they are passed to PROMPT instead of being interpreted by DOS) See 15979481
Example:
RD, or RMDIR removes a directory or subdirectory. The directory must be empty.
Example: RD \NOTNEED
TopREDIRECTION alters the normal data flow. The commands available are:
Example1: SORT SCRAMBLED.TXT > ORDERED.TXT
Example2: SORT < SCRAMBLED.TXT > ORDERED.TXT
Example1: ECHO Line of text > TEXTFILE.TXT
Example2: TYPE LONGLIST.TXT | SORT | MORE
Example3: DEBUG < COMMANDS.BUG
Example4: MEM /D | MORE
Example5: MEM /D > MEMSTUFF.TXT
Example6: DIR > DIRLIST.TXT
Example7: XCOPY C:\*.LOG D: > NUL
REM creates a remark. Remarks are not processed by .BAT files or CONFIG.SYS file. All text following REM is disregarded.
Example: REM -- These drivers are being tested. Remove if troublesome.
TopRENAME, or REN, re-names a file name. A new drive cannot be specified.
Example:
RENAME, or REN, re-names a file name. A new drive cannot be specified.
Example:
RMDIR, or RD removes a directory or subdirectory. The directory must be empty.
Example: RMDIR \NOTNEED
TopSET assigns a string value to an environment variable.
Example: SET TODAY=Monday
TopSHIFT changes the position of parameters in batch files, copying %2 to %1, %3 to %2 ...
Notes:
TIME sets the system time. Type TIME, and the system will prompt for a new time. If no new time is provided, the system time remains unchanged.
TopTo the best of my knowledge, TRUE isn't a DOS command, reserved word, or variable. If I ever figure out why it's here, I'll update this page. (TRUE is found inside the code of COMMAND.COM)
TopTYPE displays text files.
Example: TYPE C:\TEXT\STORY.TXT
TopUNLOCK disables direct disk access. See LOCK
TopVER displays the DOS version.
TopVERIFY controls DOS disk write verification.
VOL displays the disk volume label and serial number
TopATTRIB.EXE sets the attributes for one or more files. DOS marks files as Read_Only, Archive, System, or Hidden.
Example clears R&A, sets S&H: ATTRIB -R -A +S +H *.SYS
TopCHKDSK performs a quick test of the disk and reports disk statistics. Windows offers SCANDISK, a superior utility to perform the same task. See 9065977
Example: CHKDSK D:
TopAsks user to select one of given choices, then sets ERRORLEVEL to location where choice appears in list. See ERRORLEVEL
Example: CHOICE /C:ABCDEFG /T:C,3 Pick one from list
TopA debugging tool. DEBUG can edit programs and data.
This is one of those programs where those who know how to use it do not need any explanations from me. Those who know little or nothing about it should not attempt using it.
TopDELTREE deletes a directory, its subdirectories, and all files in both. Carelessness with DELTREE can have disasterous consequences.
Example: DELTREE /Y D:\JUNK
TopDISKCOPY makes a duplicate of floppy disks. Both disks must be similar.
Example: DISKCOPY A: B: /V
TopDOSKEY a TSR (Terminate and Stay Resident) utility which enhances keyboard command entry. See 11098062 and 14132028
DOSKEY can...
Example to display macros: DOSKEY /M
TopEDIT is a full screen text editor.
Example: EDIT HI_MOM.TXT
TopEXTRACT will create files from data stored in .CAB (cabinet) files.
Example: EXTRACT C:\WINDOWS\SYSBCKUP\RB001.CAB SYSTEM.INI
TopFC, or File Compare, displays the differences between files
Example: FC FEMALE.TXT MALE.TXT {Should find quite a few! (^_^)}
TopFDISK prepares the disk for MS-DOS FORMAT. FDISK will divide a disk into partitions. FDISK displays screens with questions: provide the answers and pray. See FORMAT
TopFIND searches for text strings. Text can be in files, entered through the keyboard, or re-directed by DOS.
Example: FIND "PMS" WITCHDOS.HTM
TopFORMAT prepares a disk for MS-DOS. See FDISK
Example formats a bootable floppy: FORMAT A: /S
DO NOT USE FORMAT /SELECT /U
FORMAT /Z:n sets cluster size to 2^(n+8) with n>0
TopIEXTRACT extracts a file from an IE backup information (.DAT) file. Microsoft has me baffled. I don't have a clue what this does or why it would be used. (I've lived over 50 years without IEXTRACT, and I plan on continuing that way!)
TopKEYB configures the keyboard for use with another language or character set.
TopChanges, creates, or deletes the disk volume label. Labels can be up to eleven characters.
Example: LABEL C: WIN98_DISK
TopMEM displays the system (DOS) memory usage.
Example: MEM /D /P
TopMODE configures system devices. Typically, communication and printer ports would be configured using MODE in DOS. Windows makes MODE unnecessary in most cases.
Example: MODE COM2: BAUD=9600 PARITY=NONE DATA=8 STOP=1 RETRY=N
TopMORE displays data in one screen pieces. MORE can display a file or data re-directed by DOS.
Example1: MORE BIG_LONG.TXT
Example2: TYPE BIG_LONG.TXT | MORE
TopMOVES a file from one location to another. MOVE also allows renaming. MOVE would be the equivalent of a COPY followed a DELETE of the original.
Example: MOVE D:ONE_FILE.TXT E:TWO_FILE.TXT
TopMSCDEX, or Microsoft CD Executable, enables DOS to control the CD drive. Using MSCDEX is a two step process. First, a CD driver must be loaded in the CONFIG.SYS file giving the CD device a name. Next, that name must be given to MSCDEX. MSCDEX is usually placed in the AUTOEXEC.BAT file. When these two requirements are met, DOS can use the CD drive. See 15977771
Note: Windows provides code for access to the CD. MSCDEX is needed by DOS.
Example: MSCDEX /D:PMSW_CD /L:G
MSD, or Microsoft System Diagnostics, displays hardware information. MSD will not run in a DOS window.
Example: MSD
TopNLSFUNC, or National Language Support Functions, enables DOS to load country specific language support.
TopSCANDISK is the DOS equivalent of Windows ScanDisk. Use the Windows version if possible.
TopSCANREG is a DOS based Windows Registry tool. Although it can back up the registry, it's most useful for restoring a corrupt registry from previous a previous backup. SCANREG cannot run from a DOS window.
Example: SCANREG /RESTORE
TopSORT
Sort sorts text data. SORT can sort a file or data re-directed by DOS. See REDIRECTION
Example1: SORT /+8 SCRAMBLED.TXT
Example2: SORT /R < SCRAMBLED.TXT > ORDERED.TXT
START causes a Windows program to execute from a DOS command prompt.
Hint: Use START in .BAT files.
Example: I use Norton SpeedDisk to defrag C: D: and E: in a .BAT
file with...
START /WAIT C:\PROGRA~1\NORTON~1\SD32.EXE C: /F
START /WAIT C:\PROGRA~1\NORTON~1\SD32.EXE D: /F
START /WAIT C:\PROGRA~1\NORTON~1\SD32.EXE E: /F
SUBST causes a path to simulate a disk drive. Substitution cannot be deleted from within drive created by SUBST. In Example2, the command will not complete if M: is the current directory. SUBST without parameters displays active substitutions.
Hint: SUBST can save typing when using long path names.
Example1: SUBST M: C:\MYDOCU~1
Example2: SUBST M: /D
SULFNBK, or Long File Name Backup.
Windows recognizes long file names. DOS only sees 8.3 file names. Some DOS disk utilities can destroy Windows files. SULFNKB can help.
Windows watches DOS programs, and if they write an 8.3 file name, Windows will step forward and add the long name in addition. To use SULFNBK, we must disable this activity. Right click My Computer, select Properties, Performance Tab. Select File System, File System Properties, Troubleshooting tab. Check the Disable long name preservation, click OK, and restart the computer in Command Prompt Only mode. SULFNBK can now execute.
Note: On some systems, it's LFNBK, found in \tools\reskit\files\fnback on the Windows CD.
Example (Peek at long file name data on C:): SULFNBK /P C
TopSYS makes a disk bootable. Both a source and destination for the system files can be given.
Example1 makes A: bootable: SYS C: A:
Example2 makes A: bootable: SYS A:
XCOPY is an extensive copy utility with well over a dozen options. Select commands to eliminate ambiguity between destination files and directories.
Examples...
I want to express my deepest thanks to the participants on Silicon Investor Computer Learning and Dream Machine discussion threads for their tremendous assistance to me when I was struggling to learn about Windows. I could not have created this page without their help and encouragement. Although I had the priviledge of corresponding with many very knowledgeable people on SI, I would like to name just a few here: Mark, Cow, Dog, Crow, Alex, Ish, Edwarda, CB, JS, Ed, Jay, Bike, E, TLC, Didi, Rich, and Bob.