W orkIng WIth thE c ommand P romPt
5.1 The Command Prompt Location
W orkIng WIth thE c ommand P romPt
Our focus in this chapter is on the use of the Windows built-in Command Prompt. This chapter can be considered a review for “old timers” who were brought up in the use of the Disk Operating System (DOS), which when Windows appeared was essentially regulated to the Command Prompt box and little used by most persons due to the ability to mouse around.
The rationale for including this chapter is based upon the fact that the use of Windows built-in networking tools can be facilitated by knowledge of such functions as where the Command Prompt resides, how to use function keys, and what piping is and how to take advan-tage of its use. For those who have no experience in DOS, we discuss piping in this chapter as well as other Command Prompt actions that will facilitate our use of built-in networking tools. The Command Prompt allows you to work in an environment that is like a traditional operating system as opposed to the icon-based Windows environ-ment. When working in the Command Prompt you will use your keyboard as it predates the use of a mouse, which then becomes a useless device. The Command Prompt operates at a lower level than Windows, which means that you will have more control over the computer; however, if you’re used to a point-and-click environment it is certainly less user-friendly.
5.1 The Command Prompt Location
There are several methods you can use to locate the Command Prompt. Perhaps one of the easiest methods is to use the search tool from the Start Menu in Windows. Figure 5.1 illustrates the use of Windows after this author entered “Co” into the search bar. Note that at this point the second entry from searching is the Command
Prompt. As you continue entering your search the Command Prompt entry will eventually rise to the top. The reason that the Command Prompt entry is shown shaded results from the action of this author to highlight the entry.
If you simply click on the start button or globe at the lower left corner of your screen you will see the entry All Programs directly above the search bar. Clicking on this entry will result in a display of all the pro-grams on your computer, which depending upon the use of your machine may be a considerable list. If you locate the entry Accessories, clicking on that entry will result in the display of the Command Prompt, as shown in Figure 5.2. Then selecting the Command Prompt entry will activate the Command Prompt. As an alternative, you can simply enter “cmd” at the Start Menu, which will automatically invoke the Command Prompt
Figure 5.1 Using the Windows search bar to locate the Command Prompt.
on your screen. Thus within a short period of time we have noted three methods by which the Command Prompt can be invoked. Once invoked, it will appear as an entry in a list of recent programs when you return to the Start Menu, allowing you to simply select it.
Figure 5.3 illustrates how once activated the Command Prompt will be displayed both as a small window as well as an icon at the bottom of your screen. In Figure 5.3 we see the Command Prompt
Figure 5.2 From Accessories you can also select the Command Prompt.
Figure 5.3 The Command Prompt window can be placed in the forefront by clicking on its icon on the taskbar.
window, which by default will appear on top of the browser this author was using as well as an icon at the bottom of the screen. Notice that the Command Prompt window has a black background by default with white lettering. As you examine the window you will note that it has the conventional minimize, restore, and close icons at the top right of the window; however, unlike most conventional windows in Windows, you can right-click on the top bar to obtain the abil-ity to control how the Command Prompt window and its contents will appear. In addition, unlike a normal Windows window, selecting the restore icon at the top of the window by default will toggle you between the small rectangular window and a larger rectangular win-dow. It should be noted that as you work with a variety of windows on your computer the Command Prompt window may become covered with other windows. To place the Command Prompt in the forefront for viewing you can simply click on the Command Prompt icon on the taskbar at the bottom of your screen.
The Command Prompt window is where you type commands and program names. The Command Prompt is case insensitive, which means that it does not care if you use upper- or lowercase. This means that command cd is the same as CD.
5.1.1 Options
If you right-click on the Command Prompt displayed from the Start Menu six options will be displayed from which you can select. The top option, Open, as the name implies will result in the execution of the command CD as it opens the Command Prompt window. The second option, “run as administrator,” requires you to have admin-istrative privileges. Assuming you do, selecting this option results in the Command Prompt dialog box labeled Administrative Command Prompt and will enable you to execute certain commands that require administrative privileges. The third option, Pin to Taskbar, results in the Command Prompt being pinned to the Taskbar, while the fourth option, Pin to Start Menu, pins the Command Prompt to the Start Menu. The fifth option, “remove from this list,” results in the unpin-ning of the Command Prompt, while the sixth option, Properties, results in the display of the Command Prompt Properties dialog box
that contains 10 tabs, of which the tab labeled Shortcut is shown by default in the foreground.
5.1.2 Positioning upon Opening
If you focus on the Command Prompt window shown in Figure 5.3, you will note that after the version of the Command Prompt and copy-right information are displayed, you are positioned by default on the C drive under the applicable user, in this example gilbert. To reposition the Command Prompt you would enter the Change Directory (CD) command followed by the backward slash (CD\) followed by where you want to go, which in effect represents the position you require.
For example, to position yourself to the root directory you would enter CD\. As you enter commands you will note that the contents of the Command Prompt window scroll up and eventually disappear from the screen. You can use the scroll bar on the right of the window, use your up arrow key, or expand the window to view data that scrolled off the screen. The actual amount of data available for backward scrolling will depend upon the buffer size associated with the Command Prompt.
You can easily view the buffer size by right-clicking on the top of the console window and selecting either Defaults or Properties. Selecting either option will result in the display of a dialog box with four tabs, with the one labeled Options in the foreground that will show you the cursor size, buffer size, and number of buffers, as well as allow you to adjust one or more entries. Since this addition method to view infor-mation is associated with changing the size of the Command Prompt window, let’s turn our attention to that topic.
5.1.3 Controlling the Command Prompt Window
Right-clicking on the top bar of the Command Prompt window and selecting either Defaults or Properties will result in the display of a dialog box that allows you to view various parameters associ-ated with the Command Prompt as well as change one or more values. Assuming you selected the entry labeled Properties, doing so will result in a dialog box labeled Command Prompt Properties that will have four tabs. Those tabs are shown in Figure 5.4, where by default the tab labeled Options is selected, with the other tabs
labeled Font, Layout, and Colors. The Options tab, which is shown in the foreground of Figure 5.4, enables you to select the cursor size, adjust the buffer size, which when increased allows an extended amount of past operations to be viewed, as well as perform other options. The Font tab allows you to specify the type and size of fonts as well as preview results of the selection process. The third tab, Layout, as its name implies, allows you to adjust the default position of the Command Prompt window, and adjust the screen buffer size and the window size based upon width and height char-acter entries. The fourth tab, Colors, enables you to select screen and pop-up text and background colors as well as preview your selection. As we proceed through this chapter we adjust certain features of the Command Prompt Properties tabs to enable addi-tional information to be viewed as well as captured for display in this book.