MS-DOS and Windows command line cmd command

MS-DOS and Windows control line cmd control


Computer Hope

The (CMD
in later on versions of Windows) is the command interpreter for MS-DOS and is required for Microsoft operating systems to office. Without, a computer running a Microsoft operating system would be unable to kick.

When running Windows NT, 2000, XP, Vista, 7, 8, and 10 in that location are ii versions of the control interpreter,, and
cmd.exe. Cmd offers additional environment variables than; however, we recommend if yous’re attempting to run an MS-DOS utility that y’all utilize the To use, click Showtime, Run, and type


Command, or, is the command interpreter, and with early versions of Windows and MS-DOS, yous would not be able to use the computer without this file. This file is available on all versions of Microsoft Windows, and later versions of Windows use it to admission the MS-DOS trounce.

  • All Versions of MS-DOS
  • Windows 95
  • Windows 98
  • Windows ME
  • Windows NT
  • Windows 2000
  • Windows XP

CMD, or CMD.EXE, is the command line vanquish introduced in Windows NT and available for all the following versions of Microsoft Windows.

  • Windows NT
  • Windows 2000
  • Windows XP
  • Windows Vista
  • Windows 7
  • Windows 8
  • Windows ten
  • Windows 11


Windows 2000, XP, Vista, 7, 8, and 10 “cmd” syntax

Starts a new instance of the Windows 2000 or Windows XP command interpreter.

CMD [/A | /U] [/Q] [/D] [/Eastward:ON | /E:OFF] [/F:ON | /F:OFF] [/5:ON | /Five:OFF] [[/S] [/C | /Yard] string]
/C Carries out the command specified by cord so terminates.
/Grand Carries out the command specified past string merely remains.
/S Modifies the treatment of string after /C or /One thousand (see below).
/Q Turns echo off.
/D Disable execution of AutoRun commands from registry (encounter below).
/A Causes the output of internal commands to a pipe or file to be ANSI.
/U Causes the output of internal commands to a piping or file to exist Unicode.
/T:fg Sets the foreground/background colors (run across Color /? for more info).
/East:ON Enable command extensions (encounter beneath).
/East:OFF Disable control extensions (come across below).
/F:ON Enable file and directory proper noun completion characters (run into below).
/F:OFF Disable file and directory name completion characters (see below).
/V:ON Enable delayed environment variable expansion using c as the delimiter. For example, /V:ON would allow !var! to expand the variable var at execution time. The var syntax expands variables at input time, which is quite a different thing when within of a FOR loop.
/V:OFF Disable delayed environment expansion.
Popular:   MS-DOS and Windows command line bootsect command

Note that multiple commands separated past the command separator ‘&&’ are accepted for the cord if it’s surrounded by quotes. Too, for compatibility reasons, /X is the same as /Due east:ON, /Y is the same as /E:OFF and /R is the same as /C. Any other switches are ignored.

If /C or /K is specified, the balance of the command line later the switch is processed as a command line, where the post-obit logic is used to process quote (“) characters:

1. If all the following conditions are met, then quote characters on the control line are preserved:

  • No /S switch.
  • Exactly two quote characters.
  • No special characters between the two quote characters, where special is one of: &<>()@^| characters.
  • There are i or more whitespace characters between the two quote characters.
  • The string betwixt the ii quote characters is the name of an executable file.

2. Otherwise, former behavior is to run across if the first character is a quote graphic symbol. If then, strip the leading graphic symbol and remove the last quote character on the command line, preserving any text after the concluding quote character.

If /D was Non specified on the command line, then when CMD.EXE starts, information technology looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if either or both are present, they are executed get-go.

HKEY_LOCAL_MACHINE\Software\Microsoft\Control Processor\AutoRun


HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Command Extensions are enabled by default. You may too disable extensions for a detail invocation using the /E:OFF switch. Y’all can enable or disable extensions for all invocations of CMD.EXE past setting either or both of the following REG_DWORD values to either
in the registry using REGEDT32.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Control Processor\EnableExtensions


HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

The user-specific setting takes precedence over the motorcar setting. The command line switches take precedence over the registry settings.

The command extensions involve changes or additions to the following commands.

  • DEL or ERASE
  • CD or CHDIR
  • Doc or MKDIR
  • POPD
  • Set
  • IF
  • FOR
  • CALL
  • GOTO
  • START (also includes changes to external command invocation).
  • FType
Popular:   Adobe Photoshop Help

To get specific details, type <command> /? to view the specifics. Where <command> is the name of the control you lot want specifics on.

Delayed environment variable expansion is NOT enabled past default. You lot tin can enable or disable delayed surroundings variable expansion for a particular invocation of CMD.EXE with the /5:ON or /V:OFF switch. To enable or disable completion for all invocations of CMD.EXE set either or both of the following REG_DWORD values to either
in the registry using REGEDT32.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Control Processor\DelayedExpansion


HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion

The user-specific setting takes precedence over the motorcar setting. The control line switches take precedence over the registry settings.

If delayed environment variable expansion is enabled, and then the exclamation graphic symbol tin can substitute the value of an surround variable at execution fourth dimension.

File and directory proper name completion is Not enabled by default. You can enable or disable file name completion for a item invocation of CMD.EXE with the /F:ON or /F:OFF switch. To enable or disable completion for all invocations of CMD.EXE on a car or user logon session set either or both of the following REG_DWORD values in the registry using REGEDT32.EXE:

HKEY_LOCAL_MACHINE\Software\Microsoft\Control Processor\CompletionChar HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar


HKEY_CURRENT_USER\Software\Microsoft\Control Processor\CompletionChar HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

with the hex value of a command character to use for a particular function (east.grand., 0x4 is Ctrl+D and 0x6 is Ctrl+F). The user-specific settings take precedence over the automobile settings. The command line switches have precedence over the registry settings.

If completion is enabled with the /F:ON switch, the two command characters used are Ctrl+D for directory proper noun completion and Ctrl+F for file proper noun completion. To disable a particular completion grapheme in the registry, use the value for space (0x20) as it is not a valid control character.

Completion is invoked when yous blazon either of the two control characters. The completion role appends a wildcard graphic symbol to the left of the cursor if none is present and builds up a listing of paths that lucifer. It so displays the first matching path. If no paths match, it beeps and leaves the display lonely. Subsequently that, repeated pressing of the same control grapheme will wheel through the list of matching paths. Pressing the Shift key with the control graphic symbol moves through the list backwards. If you edit the line in whatsoever mode and press the command grapheme once again, the saved list of matching paths is discarded and a new one generated. The same occurs if you switch between file and directory name completion. The difference between the ii control characters is the file completion graphic symbol matches both file and directory names, while the directory completion character simply matches directory names. If file completion is used on any of the built-in directory commands (CD, Dr. or RD) then directory completion is assumed.

Popular:   Basic computer troubleshooting steps

The completion code deals correctly with file names that contain spaces or other special characters by placing quotes around the matching path. Likewise, if y’all support, and then invoke completion from within a line, the text to the right of the cursor at the point completion was invoked is discarded.

The special characters that require quotes are:

Early Windows “command” syntax

Starts a new copy of the Windows command interpreter.

Command [[bulldoze:] path] [device] [/E:nnnnn] [/L:nnnn] [/U:nnn] [/P] [/MSG] [/Low] [/Y [/C|K] command]
[drive:]path Specifies the directory containing Control.COM.
device Specifies the device to utilize for command input and output.
/E:nnnnn Sets the initial environment size to nnnnn bytes. (nnnnn should be between 256 and 32,768).
/50:nnnn Specifies internal buffers length (requires /P likewise). (nnnn should exist between 128 and one,024).
/U:nnn Specifies the input buffer length (requires /P too). (nnn should exist betwixt 128 and 255).
/P Makes the new command interpreter permanent (tin’t get out).
/MSG Stores all error letters in memory (requires /P too).
/Depression Forces COMMAND to keep its resident data in low retentiveness.
/Y Steps through the batch plan specified by /C or /K. Simply available in MS-DOS half-dozen.x and above.
/C command Executes the specified control and returns.
/M control Executes the specified command and continues running.
/Z Display the errorlevel of every command executed. But available in MS-DOS vii.ten and in a higher place.



This example opens the cmd command beat out. If y’all were already in a control shell and run the “cmd” or “command” command at the command line, a new Windows command line would be opened. Typing “exit” would leave the new command line and return you to the original command line.