CompTIA A_ Certification All-In-One Exam Guide, Seventh Edition - Michael Meyers [248]
* * *
NOTE It helps to visualize a directory tree as upside down, because in geekspeak, the trunk, or root directory, is described as “above” the folders that divide it, and those subfolders “below” root are spoken of as being “above” the other subfolders inside them. For example, “The file is in the Adobe folder under Program Files.”
When describing a drive, you use its letter and a colon. For example, the hard drive would be represented by C:. To describe the root directory, put a backslash (\) after the C:, as in C:\. To describe a particular directory, add the name of the directory. For example, if a PC has a directory in the root directory called TEST, it is C:\TEST. Subdirectories in a directory are displayed by adding backslashes and names. If the TEST directory has a subdirectory called SYSTEM, it is shown like this: C:\TEST\SYSTEM. This naming convention provides for a complete description of the location and name of any file. If the C:\TEST\SYSTEM directory includes a file called TEST2.TXT, it is C:\TEST\SYSTEM\TEST2.TXT.
The exact location of a file is called its path. The path for the TEST2.TXT file is C:\TEST\SYSTEM. Here are some examples of possible paths:
C:\PROGRAM FILES
C:\WINNT\system32\1025
F:\FRUSCH3\CLEAR
A:\REPORTS
D:\
Here are a few items to remember about folder names and filenames:
Folders and files may have spaces in their names.
The only disallowed characters are the following eleven: * “ / \ [ ] : ; | = ,
Files aren’t required to have extensions, but Windows won’t know the file type without an extension.
Folder names may have extensions—but they are not commonly used.
Mastering Fundamental Commands
It’s time to try using the command line, but before you begin, a note of warning is in order: the command-line interface is picky and unforgiving. It will do what you say, not what you mean, so it always pays to double-check that those are one and the same before you press ENTER and commit the command. One careless keystroke can result in the loss of crucial data, with no warning and no going back. In this section, you’ll explore the structure of commands and then play with four commands built into all versions of Microsoft’s command-line interface: DIR, CD, MD, and RD.
Structure: Syntax and Switches
All commands in the Windows command-line interface use a similar structure and execute in the same way. You type the name of the command, followed by the target of that command and any modifications of that command that you want to apply. You can call up a modification by using an extra letter or number, called a switch or option, which may follow either the command or the target, depending on the command. The proper way to write a command is called its syntax. The key with commands is that you can’t spell anything incorrectly or use a \ when the syntax calls for a /. The command line is completely inflexible, so you have to learn the correct syntax for each command.
[command] [target (if any)] [switches]
or
[command] [switches] [target (if any)]
How do you know what switches are allowed? How do you know whether the switches come before or after the target? If you want to find out the syntax and switches used by a particular command, always type the command followed by a /? to get help.
DIR Command
The DIR command shows you the contents of the directory where the prompt is focused. DIR is used more often than any other command at the command prompt. When you open a command-line window in Windows, it opens focused on your user folder. You will know this because the prompt in 2000/XP will look like this: C:\Documents and