
COMMAND.COM

COMMAND.COM is the default command-line interpreter for MS-DOS, Windows 95, Windows 98, Windows 98SE and Windows Me. In the case of DOS, it is the default user interface as well. It has an additional role as the usual first program run after boot (init process), hence being responsible for setting up the system by running the AUTOEXEC.BAT configuration file, and being the ancestor of all processes.
COMMAND.COM's successor on OS/2 and Windows NT systems is cmd.exe, although COMMAND.COM is available in virtual DOS machines on IA-32 versions of those operating systems as well.
The filename was also used by (DCP), an MS-DOS derivative by the former East German VEB Robotron.
The compatible command processor under FreeDOS is sometimes also named FreeCom.
COMMAND.COM is a DOS program. Programs launched from COMMAND.COM are DOS programs that use the DOS API to communicate with the disk operating system.
Operating modes.
As a shell, COMMAND.COM has two distinct modes of operation. The first is interactive mode, in which the user types commands which are then executed immediately. The second is batch mode, which executes a predefined sequence of commands stored as a text file with the .BAT extension.
Internal commands.
Internal commands are commands stored directly inside the COMMAND.COM binary. Thus, they are always available but can only be executed directly from the command interpreter.
All commands are executed after the key is pressed at the end of the line. COMMAND.COM is not case-sensitive, meaning commands can be typed in any mixture of upper and lower case.
Batch file commands.
Control structures are mostly used inside batch files, although they can also be used interactively.
IF command.
On exit, all external commands submit a return code (a value between 0 and 255) to the calling program. Most programs have a certain convention for their return codes (for instance, 0 for a successful execution).
If a program was invoked by COMMAND.COM, the internal IF command with its ERRORLEVEL conditional can be used to test on error conditions of the last invoked external program.
Under COMMAND.COM, internal commands do not establish a new value.
Variables.
Batch files for COMMAND.COM can have four kinds of variables:
Redirection, piping, and chaining.
Because DOS is a single-tasking operating system, piping is achieved by running commands sequentially, redirecting to and from a temporary file. COMMAND.COM makes no provision for redirecting the standard error channel.
Limitations.
The command line length in interactive mode is limited to 126 characters.
In popular culture.
The message "Loading COMMAND.COM" can be seen on a HUD view of the Terminator and the internal viewport of RoboCop when he reboots.
In the CGI children's TV series "ReBoot", which takes place inside computers, the leader of a system (the equivalent of a city) is called the COMMAND.COM.