Tips for Using Console Commands


There are two commands that are absolutely necessary to get started. One is the Dir command, and the other is CD. Dir is the Directory command, and it displays the contents of the currently selected directory, as shown in Figure 6-3. From right to left, the Dir command displays the date the directory or file was created, a designation of whether the listed item is a file or subdirectory, and then the name. This is the default display setting, and it can be modified, as you will see.

Figure 6-3. The Dir command displays directory contents.


CD is the Change Directory command, and it will let you move around your hard drive's directory tree. (You can also use CHDIR.) CD is the command equivalent of clicking from folder to folder in a Windows Explorer interface (more about Windows Explorer in Chapter 7, "Clicking Less").

Even the mildly curious should quickly pick up these two commands. You can further modify the behavior of the Dir command using any of these available switches:

  • dir /q. The /q switch displays the file's or directory's owner. This can be a timesaver when you're working in a command console and don't want to switch back to the GUI to look up the properties of a file.

  • dir /t. Used to specify the time field displayed in the directory list. By default, the c field displays, showing the file creation date. The value can be changed using the command dir /t timefield, in which timefield is one of the following:

    • a last access

    • w last written

    • c creation date

  • dir /o. The /o switch sorts output according to parameters you specify. For example, dir /o by itself places folders at the top of the list, followed by files, and the list is in alphanumeric order.

    You can use additional parameters to control the sort operation. The n parameter, for example, sorts the output according to name. The p parameter pauses after every screen of information, and the s parameter sorts by size, listing the smallest files first. For a full listing, remember to use the dir /? command.

You also can employ more than one search parameter at once. For example, if you typed dir /oge, the resulting output would place folders first in the list and then would group the listing according to extension, placing file extensions in alphanumeric order.

The CD command lets you navigate your computer. Its general syntax is:

CD pathname

where pathname is the drive letter and folder, including subfolders, of the directory you are navigating to. For example, to change from the current directory shown in Figure 6-3 to the \Downloads directory on the D: drive, you would enter the following command:

 CD d:\downloads. 

The prompt would then change from C:\Documents and Settings\The Dude> to D:\Downloads, assuming that the \Downloads folder existed.

If you type CD and then just a folder name, the folder must exist in the current directory. For example, the \Desktop folder exists as a subdirectory of C:\Documents and Settings\The Dude. To change to the \Desktop directory, I could just type CD desktop.

You can also navigate up the folder structure by typing CD. (including the period).



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