Section 6.2. Command Prompt Choices

6.2. Command Prompt Choices

Windows XP 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 known as a DOS box because of its visual and functional likeness to DOS, the Command Prompt window (see Figure 6-1) is the most complete implementation of the command prompt in Windows XP. Any program, GUI or command- line-based , can be started 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 6-1. 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 below is that the Command Prompt maintains context between commands. Each instance of the command interpreter runs in its own virtual machine, 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 Run prompt or the Address Bar. Since 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, you'll get a "not recognized" error.

Note that Windows XP also includes command.com, the Command Prompt application found in Windows 9x/Me. While 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.


Start Run

Any program can be run by typing its executable filename here, as shown in Figure 6-2, 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 6-2. The Start Run dialog

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.

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 you've enabled the Address Bar, there's little need for Start Run, since the Toolbar is so much more convenient .


Address Bar

The Address Bar, shown in Figure 6-3, is nearly the functional equivalent of Start Run, with a few exceptions. There are actually three different Address Toolbars: the one attached to the Taskbar, the one that's part of Windows Explorer, and the one that's part of Internet Explorer.

Figure 6-3. The Address Bar on the Taskbar

The Taskbar Address Bar can be enabled 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 can be enabled in Windows Explorer and Internet Explorer by going to View Toolbars Address Bar. In either of these Windows, the launching programs is handled the same way as with the Taskbar Address Bar and with Start Run.

The various Address Bars differ only in the way folder names and web addresses are handled. If you type a folder name into either Windows Explorer or Internet Explorer, the contents of that folder will be shown in the current window (i.e., no new window will be opened). If a web address, such as http://www.annoyances.org/, is typed into the Taskbar Address Bar or the Windows Explorer Address Bar, that address is opened in the default web browser. If, the other hand, an address is typed into Internet Explorer's Address Bar, the page at that address is opened in IE regardless of the default browser setting.

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 won't recognize, though, like BigBadaBoom , what happens next depends on where the text was typed. If you type the text into an Address Bar, Windows XP will open a web browser to the location http://BigBadaBoom/ and then complain that the web site doesn't exist. If you type the same text at the Start Run prompt, you'll get an error message explaining that "Windows cannot find BigBadaBoom."



Windows XP in a Nutshell
Windows XP in a Nutshell, Second Edition
ISBN: 0596009003
EAN: 2147483647
Year: 2003
Pages: 266

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