Windows 7 / Getting Started

CMD Versus COMMAND

One tip-off that the command prompt is not the same as it was back in the prehistoric MS-DOS days is that it's managed by a program called CMD.EXE. CMD was introduced in Windows NT and is the command shell on all modern versions of Windows.You might remember that the original MS-DOS command program was called COMMAND.COM; most people became aware of its name thanks to DOS's propensity to print "Cannot load COMMAND.COM" and then come to a screeching halt.

Programs such as CMD and COMMAND are called shells because they encase an operating system.Their purpose is to mediate between the user and the programs he wants to run. Shells were the only user interfaces available in early mini- and microcomputer operating systems such as Unix, Multics, RSX-11M, and CP/M. In fact, the phrase graphical user interface came about as a way to distinguish the new generation of graphical interfaces from the old command-line shells.

The earliest shells could do little more than prompt for the name of a program and then locate and run the program. People got tired of typing the same commands over and over, so operating system developers provided ways to let the shell read a list of commands from a file and then run each in turn. Eventually, shells grew into little programming languages of their own, and the shell script or batch file was born.This concept blossomed on the Unix operating system back in the 1970s and ultimately made its way to MS-DOS, although in a much degraded form.The MS-DOS command prompt and its batch language were limited, peculiar, and inflexible.

Although CMD.EXE and its batch file language are still somewhat burdened with the legacy of COMMAND.COM, some significant new features make the command line a friendlier place to work.

In this tutorial, I focus on aspects of CMD that apply to direct use in the Command Prompt window. Everything in this tutorial applies to batch files as well.

Tip Microsoft's TechNet website has a good article about the command-prompt environment. It was originally published in Windows NT Shell Scripting. Although it's missing a few of the enhancements added between NT 4 and current versions of Windows, it's still a detailed and lucid paper. To find it, search www.microsoft.com for "The Windows NT Command Shell," using the quotes.

[Contents] [Next]