Cmd.exe
Encyclopedia
Command Prompt is the Microsoft-supplied command-line interpreter on OS/2
, Windows CE
and on Windows NT
-based operating systems (including Windows 2000
, XP
, Vista
, 7, Server 2003
and Server 2008). It is the analog of
and Windows 9x
(where it is called MS-DOS Prompt) systems, or of the Unix shell
s used on Unix-like
systems.
.
Both the OS/2 and the Windows NT versions of
, Windows Server 2008, and Windows 7.
program,
, it can use real pipes
in command pipelines, allowing both sides of the pipeline to run concurrently. As a result, it is possible to redirect the standard error in
In reality,
The extensions can be disabled, providing a stricter compatibility mode.
OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...
, Windows CE
Windows CE
Microsoft Windows CE is an operating system developed by Microsoft for embedded systems. Windows CE is a distinct operating system and kernel, rather than a trimmed-down version of desktop Windows...
and on Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...
-based operating systems (including Windows 2000
Windows 2000
Windows 2000 is a line of operating systems produced by Microsoft for use on personal computers, business desktops, laptops, and servers. Windows 2000 was released to manufacturing on 15 December 1999 and launched to retail on 17 February 2000. It is the successor to Windows NT 4.0, and is the...
, XP
Windows XP
Windows XP is an operating system produced by Microsoft for use on personal computers, including home and business desktops, laptops and media centers. First released to computer manufacturers on August 24, 2001, it is the second most popular version of Windows, based on installed user base...
, Vista
Windows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...
, 7, Server 2003
Windows Server 2003
Windows Server 2003 is a server operating system produced by Microsoft, introduced on 24 April 2003. An updated version, Windows Server 2003 R2, was released to manufacturing on 6 December 2005...
and Server 2008). It is the analog of
COMMAND.COMCOMMAND.COMCOMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...
in MS-DOSMS-DOS
MS-DOS is an operating system for x86-based personal computers. It was the most commonly used member of the DOS family of operating systems, and was the main operating system for IBM PC compatible personal computers during the 1980s to the mid 1990s, until it was gradually superseded by operating...
and Windows 9x
Windows 9x
Windows 9x is a generic term referring to a series of Microsoft Windows computer operating systems produced since 1995, which were based on the original and later modified Windows 95 kernel...
(where it is called MS-DOS Prompt) systems, or of the Unix shell
Unix shell
A Unix shell is a command-line interpreter or shell that provides a traditional user interface for the Unix operating system and for Unix-like systems...
s used on Unix-like
Unix-like
A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
systems.
Versions
Therese Stowell developed the initial version ofcmd.exe
for Windows NT. Although some old DOS commands are unsupported or have been changed (ex: the functionality of deltreeDeltreedeltree is a command line command in Microsoft operating systems that deletes an entire subdirectory of files. It appeared in MS-DOS 6, and was retained throughout all Windows versions based upon MS-DOS, including Windows 95, Windows 98, and Windows Me...
was rolled into rdRmdirrmdir is a command which will remove an empty directory on a Unix, DOS, OS/2 or Microsoft Windows operating system. In Unix, Linux, and MacOS, it is case sensitive, whereas DOS, OS/2 and Windows , you can type the characters in any combination of upper case and lower case letters, and rd/rmdir...
in the form of the /s parameter), cmd.exe
still has a greater number of built-in commandsShell builtin
In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute....
.
Both the OS/2 and the Windows NT versions of
cmd.exe
have more detailed error messages than the blanket "Bad command or file name" (in the case of malformed commands) of command.com. In the OS/2 version of cmd.exe
, errors are reported in the current language of the system, their text being taken from the system message files. The help command can then be issued with the error message number to obtain further information.cmd.exe
remains part of Windows VistaWindows Vista
Windows Vista is an operating system released in several variations developed by Microsoft for use on personal computers, including home and business desktops, laptops, tablet PCs, and media center PCs...
, Windows Server 2008, and Windows 7.
Technical information
UnlikeCOMMAND.COMCOMMAND.COMCOMMAND.COM is the filename of the default operating system shell for DOS operating systems and the default command line interpreter on Windows 95, Windows 98 and Windows Me...
, which is a DOSDOS
DOS, short for "Disk Operating System", is an acronym for several closely related operating systems that dominated the IBM PC compatible market between 1981 and 1995, or until about 2000 if one includes the partially DOS-based Microsoft Windows versions 95, 98, and Millennium Edition.Related...
program,
cmd.exe
is a native program for the platform. This allows it to take advantage of features available to native programs on the platform that are otherwise unavailable to DOS programs. For example, since cmd.exe
is a native text-mode application on OS/2OS/2
OS/2 is a computer operating system, initially created by Microsoft and IBM, then later developed by IBM exclusively. The name stands for "Operating System/2," because it was introduced as part of the same generation change release as IBM's "Personal System/2 " line of second-generation personal...
, it can use real pipes
Pipeline (Unix)
In Unix-like computer operating systems , a pipeline is the original software pipeline: a set of processes chained by their standard streams, so that the output of each process feeds directly as input to the next one. Each connection is implemented by an anonymous pipe...
in command pipelines, allowing both sides of the pipeline to run concurrently. As a result, it is possible to redirect the standard error in
cmd.exe
, unlike COMMAND.COM
. (COMMAND.COM
uses temporary files, and runs the two sides serially, one after the other.)In reality,
cmd.exe
is a Windows program that acts as a DOS-like command line interpreter. It is generally compatible, but provides extensions which address some of the limitations of COMMAND.COM
:-
SETLOCAL
/ENDLOCAL
commands limit the scope of changes to the environment - internal
CALL
andGOTO
labels lessen the need for individual batch files to perform parts of a task.Gotogoto is a statement found in many computer programming languages. It is a combination of the English words go and to. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control... - filename-parsing extensions to the
SET
command are comparable to C shellC shellThe C shell is a Unix shell that was created by Bill Joy while a graduate student at University of California, Berkeley in the late 1970s. It has been distributed widely, beginning with the 2BSD release of the BSD Unix system that Joy began distributing in 1978...
. - an expression-evaluation extensions is also provided in the
SET
command. - an expansion of the
FOR
command to support parsing files and arbitrary sets in addition to filenames. - use of arrow keys to scroll through command history (provided by
DOSKey
inDOSKeyDOSKey is a utility for MS-DOS and Microsoft Windows that adds command history, macro functionality, and improved editing features to the command line interpreters COMMAND.COM and cmd.exe...COMMAND.COM
) - off-by-default path completion capabilities similar to
bash
tab completion - a directoryDirectory (file systems)In computing, a folder, directory, catalog, or drawer, is a virtual container originally derived from an earlier Object-oriented programming concept by the same name within a digital file system, in which groups of computer files and other folders can be kept and organized.A typical file system may...
stack accessible with thePUSHD
andPushd and popdIn computing, pushd and popd are commands in various Unix, DOS and Microsoft Windows command line interpreters such as Bash, cmd.exe, 4DOS/4NT and Windows PowerShell...POPD
commandsPushd and popdIn computing, pushd and popd are commands in various Unix, DOS and Microsoft Windows command line interpreters such as Bash, cmd.exe, 4DOS/4NT and Windows PowerShell... -
IF
can perform case-insensitiveCase sensitivityText sometimes exhibits case sensitivity; that is, words can differ in meaning based on differing use of uppercase and lowercase letters. Words with capital letters do not always have the same meaning when written with lowercase letters....
comparisons and numeric equality and inequality comparisons in addition to case-sensitive string comparisons - the ability to escapeEscape characterIn computing and telecommunication, an escape character is a character which invokes an alternative interpretation on subsequent characters in a character sequence. An escape character is a particular case of metacharacters...
reserved characters by using the caretCaretCaret usually refers to the spacing symbol ^ in ASCII and other character sets. In Unicode, however, the corresponding character is , whereas the Unicode character named caret is actually a similar but lowered symbol: ....
character (^
)
The extensions can be disabled, providing a stricter compatibility mode.
External links
- MSDN Documentation for cmd.exe on Windows XP
- DOS Batch - CALL Functions and Recursion
- Windows CMD Commands, Quick list of CMD commands