When you run a 32-bit console program, it is executed by
cmd; when you run a 16-bit console program, it is executed by
Windows XP includes a subsystem to support older 16-bit applications.
Old 16-bit applications are available as both DOS and Windows programs. DOS programs by their nature are console applications and run in what looks like the command-prompt. However 32-bit Windows console applications are very similar and look the same.
The command processor/interpreter
cmd has several purposes:
- To execute 32-bit text Windows console program
- To provide and handle various command-line functions (
- Interpret and execute batch files (DOS compatible
.bat files and NT compatible
When you run an old 16-bit console program, it is executed by the NTVDM (Windows NT Virtual DOS Machine). It provides an emulated DOS system (hence the virtual DOS machine) which is similar to running a dedicated virtual machine software, except the emulation layer is simpler.
command is a 16-bit version of the command-interpreter that is much closer to actual DOS than
cmd.exe which is actually a Windows program (and has the Windows PE header, unlike
command.com which has the DOS MZ header).
command has the same purposes as
cmd except that it only supports 16-bit programs. In addition, it does not support
.cmd files and has fewer built-in commands and is more limited in its syntax (
cmd is a newer, more modern, more advanced command-line interpreter, similar to 4DOS).
However, it supports graphical DOS programs (like old games), but the success of running them depends on the video-card drivers and the nature of the program. There are numerous sites that offer various tricks to get DOS games to run on Windows (though success on Vista and up is usually more limited than on XP).
It should be noted that 64-bit versions of Windows have completely dropped support of 16-bit programs, and so do not include
command at all, so neither DOS nor Windows 16-bit programs will run and instead will throw a (misleading) error message.
command.com has a
.com extension for backwards compatibility with DOS programs, but like most of the other Windows versions of external DOS commands, internally, it is actually a Windows PE
.exe file. This provides the interesting observation that Windows while Windows uses the extension as an indicator of how to handle most file-types, for executable ones, it ignores the extension and looks at its contents (otherwise an
.exe would not work if treated as a
.com). This question relates to this effect.