Section 14.2. Command Prompt Choices


14.2. Command Prompt Choices

Windows Vista provide three different components, all essentially different implementations of the command-line interface. These three components work similarly, but there are some important differences and limitations:


Command Prompt (cmd.exe)

Commonly referred to as a DOS box because of its visual and functional likeness to DOS, the Command Prompt window (see Figure 14-2) is the most complete implementation of the Command Prompt in Windows Vista. You can start any program, GUI- or command-line-based, by typing its executable filename at the prompt. In addition, a variety of internal DOS commands (discussed later in this chapter), used primarily for file management, can be executed at the prompt.

Figure 14-2. The Command Prompt window

If a command-line-based program is launched, it is run in the same window. Many Command Prompt applications simply display information and quit; in this case, you'd be returned to the prompt immediately after the program output.

An important distinction between the Command Prompt and the alternatives that follow is that the Command Prompt maintains context between commands. Each instance of the command interpreter runs in its own session, each with its own "environment." The environment includes such information as the current directory, the search path (the directories in which the command interpreter looks for the commands whose names you type), and the format of the prompt. Some commands, once issued, change the environment for subsequent commands. The most obvious example of this is when you type a sequence of commands, like this:

 C:>cd \stuff C:\Stuff>notepad myfile.txt 

This command sequence couldn't be carried out at either the Start Search box or the Address Bar. Because they execute only one command at a time and then exit, the context is lost between each command. Concepts such as "change directory," therefore, have no meaning.

But the Command Prompt has limitations as well. Unlike the Address Bar or Start Run, if you type a web address (URL) or the name of a folder at the Command Prompt, youll get a "not recognized" error. However, if you prefix the URL with start, as in start www.oreilly.com, you'll be able to launch the URL.

Note that Windows Vista also includes command.com, the Command Prompt application found in Windows 9x/Me. Although visually and functionally similar to cmd.exe, it's included for legacy support only. cmd.exe is more sophisticated and has native support for long filenames. command.com, on the other hand, runs under a virtualized 16-bit environment using ntvdm, the NT Virtual DOS Machine. And it does, through some kind of Windows sleight of hand, support long filenames. However, there are some things it can't handle as well as cmd.exe. For example, cmd.exe has no problem working with filenames that have spaces in them, but command.com needs you to use the 8+3 name:

 C:\Temp>mkdir "Zip Files" C:\Temp>command Microsoft(R) Windows DOS (C)Copyright Microsoft Corp 19902001. C:\TEMP>cd "Zip Files" Parameter format not correct -  "Zip C:\TEMP>dir /x  Volume in drive C has no label.  Volume Serial Number is A08C-22D0  Directory of C:\Temp 10/24/2006  06:36 PM    <DIR>                       . 10/24/2006  06:36 PM    <DIR>                       .. 10/24/2006  06:36 PM    <DIR>          ZIPFIL~1     Zip Files                0 File(s)              0 bytes                3 Dir(s)  19,739,947,008 bytes free C:\TEMP>cd ZIPFIL~1 C:\TEMP\ZIPFIL~1> 


Start Run

You can run any program by typing its executable filename here, as shown in Figure 14-3, just like in a Command Prompt window. However, in the case of command-line-based programs, the context is lost every time a new program is launched. Internal Command Prompt commands, such as CD and DIR, discussed later in this chapter, are not recognized here or in the Address Bar.

Figure 14-3. The Start Run dialog

The Start Run box isnt visible by default in Windows Vista, but there is a way to turn it on. Right-click the Taskbar and choose Properties Start Menu. Then click Customize next to the Start Menu entry, check the box next to the Run command, click OK, and then OK again. Windows XPs old Run box will now be available from the Start menu. You can also launch the Start Run box by pressing Windows Key-R.


Unlike the Command Prompt, you can type a web address (URL) here to open it in the default web browser, or any folder name to open it in an Explorer folder window. If you're using the Command Prompt, though, you can preface a URL or folder name with start and you'll be able to launch the URL or open the folder.

Start Run is commonly used to start programs, which is an alternative to wading through Start Programs or opening a new Command Prompt window. However, if youve enabled the Address Bar, there's little need for Start Run, because the toolbar is so much more convenient.

You can also type commands into Start Search, but doing so has similar drawbacks to the Start Run boxand other drawbacks as well. It will perform a search rather than directly issuing a command, so you may launch a file accidentally rather than issue a command if Search finds a file that matches the command you type in.



Address Bar

The Address Bar, shown in Figure 14-4, is nearly the functional equivalent to Start Run, with a few exceptions. There are actually two different Address Bars: the one attached to the Taskbar, and the one thats part of Windows Explorer.

Figure 14-4. The Address Bar on the Taskbar

You can enable the Taskbar Address Bar by right-clicking on an empty area of the Taskbar and selecting Toolbars Address. This implementation is functionally identical to Start Run.

The Address Bar in Windows Explorer is automatically enabled. The launching of programs is handled the same way as with the Taskbar Address Bar and with Start Run.

Internet Explorer also includes an Address Bar, although its purpose is to visit web sites rather than issue commands. However, you also can use it to launch Windows Explorer to a specific folder. For example, type C:\My Files into the Address Bar, and Windows Explorer will open to the C:\My Files folder.

You can also type web addresses, such as http://www.windowsdevcenter.com, into the Taskbar Address Bar, into Start Run, and into Start Start Search, and the site will be opened in your default browser.

The main difference between the Address Bar and the Start Run prompt is in the assumptions that are made about ambiguous names and addresses. For example, if you type Notepad or http://www.annoyances.org into either place, Windows would launch a program or web site, respectively. If you type something that Windows wont recognize, though, such as BigBadaBoom, what happens next depends on where you typed the text. If you typed the text into an Address Bar, Windows Vista would open a web browser to the location http://BigBadaBoom and then complain that the web site doesn't exist. If you typed the same text at the Start Run prompt, youd get an error message explaining that "Windows cannot find BigBadaBoom."



Windows Vista in a Nutshell
Windows Vista in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596527071
EAN: 2147483647
Year: 2004
Pages: 107

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