Command.com v. Cmd.exe


There's yet another way to launch the command prompt: by typing command.com at the Run dialog box. Or at least so it seems. True, Command.com does in fact launch what looks like the Command Prompt, but if you look carefully, you'll notice that Command.com's window looks a little different. More significantly, it also behaves a little different as well.

If you compare the Cmd.exe and the Command.com windows side-by-side, as shown in Figure 6-2, you'll see that the Cmd.exe program launches the XP command prompt, while the Command.com program launches the DOS environment.

Figure 6-2. Command.com and Cmd.exe are not the same.


What's the big difference? NT. I'll give you the précis: NT is the Microsoft operating system that was developed to exist entirely separately from the Disk Operating System (DOS). Windows 3.x, 95, 98, and Me, on the other hand, were essentially meant as a graphical shell that executed DOS commands behind the scenes.

Both Command.com and Cmd.exe can be described as command environments, in that they take instructions in the form of text commands. Cmd.exe, the one we focus on throughout this chapter, is the Windows NT tool. It is a 32-bit command-line interpreternot an operating systemand is the default method of passing command instructions to the NT operating system kernel. When you launch the Command Prompt in XP using the Start Menu, you run Cmd.exe.

Command.com, on the other hand, is the 16-bit version of DOS that is launched in an NT "Virtual Machine." It's included for backward compatibility with older MS-DOS (16-bit) text-interface programs you may have to run on an XP machine. You cannot run a 32-bit program in a Command.com window.

In fact, when using Command.com, the program that actually runs is NTVDM.exe, the NT Virtual DOS Machine. Unlike Cmd.exe, a failure in one NTVDM program will affect all other programs running in the Virtual Machine.

One of the more easily recognizable differences between the two command processors is that only Cmd.exe, due to its 32-bit nature, understands long filenames. Notice that the 16-bit Command.com can only deal with DOS 8.3 naming conventions. Directory names like "Documents and Settings" are therefore truncated into DOS-digestible "DOCUME~1."

Henceforth, this chapter assumes you are using Cmd.exe. In fact, some of the techniques explained, such as AutoComplete, only work only when using Cmd.exe. AutoComplete doesn't work with Command.com.

As a final note, if you try to close the Command.com window by clicking the "X," you'll get a message that the program is not responding. The program that's not responding is the NT Virtual DOS machine. Type exit to end the NTVDM.



Spring Into Windows XP Service Pack 2
Spring Into Windows XP Service Pack 2
ISBN: 013167983X
EAN: 2147483647
Year: 2004
Pages: 275
Authors: Brian Culp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net