COMSPEC
or is one of the environment variables used in DOS, OS/2 and Windows, which normally points to the command-line interpreter, which is by default in DOS, Windows 95, 98, and ME or in OS/2 and Windows NT.
≈ 4 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
COMSPEC or ComSpec is one of the environment variables used in DOS, OS/2 and Windows, which normally points to the command-line interpreter, which is by default COMMAND.COM in DOS,[1] Windows 95, 98, and ME or CMD.EXE in OS/2 and Windows NT. The variable name is written in all-uppercase under DOS and OS/2. Under Windows, which also supports lowercase environment variable names, the variable name is defined as ComSpec in the environment block, but as COMSPEC inside the DOS emulator NTVDM.
When not present in the environment block, the command processor CMD.EXE of Windows NT sets COMSPEC to its own full path; it evaluates COMSPEC, for example, to execute builtin commands in pipelines and to execute command lines with its builtin FOR command.[2]
The variable's contents can be displayed by typing SET COMSPEC or ECHO %COMSPEC% at the command prompt.
The environment variable by default points to the full path of the command-line interpreter. It can also be made by a different company or be a different version.
Another use of this environment variable is on a computer with no hard disk, which needs to boot from a floppy disk, is to configure a RAM disk. The COMMAND.COM file is copied to the RAM disk during boot, and the COMSPEC environment variable is set to the new location on the RAM disk. This way the boot disk can be removed without the need to reinsert it after a big application has been stopped. The command-line interpreter will be reloaded from the RAM disk instead of the boot disk.
References
edit edit source- ^ PC-DOS 7.0 User Guide (1st ed.). IBM. January 1995. pp. 55, 283, 290. Wikipedia revision 1331957618, retrieved 2026-11-19
- ^ "Idiosyncrasies – Odd, Surprising, Un(der)documented or Weird (Mis)behaviour of Microsoft® Windows® NT". Wikipedia revision 1331957618, retrieved 2026-11-19
External links
edit edit source- Creating a customized Command Prompt shortcut – example of COMSPEC usage
compatible systems
- AmigaDOS
- AMSDOS
- ANDOS
- Apple DOS
- Apple ProDOS
- Apple SOS
- Atari DOS
- Atari TOS
- BW-DOS
- Commodore DOS
- Concurrent DOS 68K
- Concurrent DOS V60
- CP/M
- Cromemco DOS
- CSI-DOS
- DEC BATCH-11/DOS-11
- DIP DOS
- DOS/360
- DOS XL
- Edos
- EOS
- FLEX
- GEMDOS
- IDEDOS
- IMDOS
- iS-DOS
- ISIS
- MDOS
- MicroDOS
- MP/M
- MSX-DOS
- MyDOS
- NewDos/80
- OS/M
- PTDOS
- RealDOS
- SB-80
- SCP
- Sinclair QDOS
- RDOS
- SmartDOS
- SpartaDOS
- SpartaDOS X
- Technical Support SuperDOS
- Top-DOS
- TR-DOS
- TRSDOS
- TurboDOS
- UDOS
- Z-DOS
- Z80-RIO
Text derived from https://en.wikipedia.org/w/index.php?oldid=1331957618 under CC BY-SA 4.0; modifications have been made.