Ch 2 Command Syntax



Chapter 2

Command Syntax—

Using the DIR Command with Parameters &Wildcards

ANSWERS TO DISCUSSION QUESTIONS (p. 86)

1. Define command syntax.

Command syntax is the language, punctuation, and order needed to execute a command properly. You use command syntax to communicate with software in general and DOS in particular. It means using the correct command, required and optional parameters, and the proper order for keying in commands.

2. Why is syntax important when using a command?

It is important to use the proper syntax in order to make the computer understand what you want. You need to give the computer instructions in the order that the computer expects them.

3. Define parameters.

A parameter is some piece of information that you want a command to have. It is the information placed on the command line with a command. Parameters give commands additional information, or alter the way the commands work. Parameters can be optional or mandatory, variable or fixed.

4. What is the difference between a variable and a fixed parameter?

Variable parameters provide additional information or values that a program needs. The user supplies the needed value.

Fixed parameters also alter the way a program works, but the values are supplied by the OS and cannot be altered.

5. How would you use a syntax diagram? Why is the diagram important?

A syntax diagram is a graphic representation of a command and its syntax. The syntax diagram is used to explain the command syntax. These diagrams give the name of the command, and all the parameters that can be used, along with the order in which they must be used. With these diagrams, you can find the correct way to use commands.

6. Name two parameters that can be used with DIR command. Explain why you would use the parameters.

Parameters are used to make the action of a command more specific.

Some examples include:

/P - fill the screen and then pause until user takes some action.

/W - display the directory in a wide format.

/W/P - see files in a wide display, one screenful at a time.

7. Define delimiters. Give an example of a delimiter.

Delimiters are used to separate independent items such as commands and their parameters. A delimiter indicates where parts of a command begin or end. Delimiters are similar to punctuation marks in English. A common delimiter is the slash, as in DIR /P, or the period that separates a file name from the file extension.

8. Define file specifications.

The file specification is the formal name of a file. The file specification consists of two parts. The first part is called the file name. The file name should reflect the subject of the file. File names are mandatory.

The second part of the file specification is called the file extension (file type). It is usually given by the application creating the file. It is not mandatory and file extensions are usually three characters long.

9. How do you separate a file name and a file extension?

File names are separated from file extensions with a dot (.). In a directory listing, it is separated by spaces, but users must use the dot.

10. What is used to separate a file specification from a path name?

A backslash (\) is used to separate a file specification from a path name.

11. What is the function and purpose of a device?

A device is a place for the computer to read from or write to. Keyboards, monitors, printers, and disk drives are all devices. Each device attached to the computer has a reserved, specific, and unique name. This enables the OS to communicate with a specific device. Disk drives are designated by a letter followed by a colon, as in A: The printer has the device name of PRN, LPT1, or LPT2. The console is called CON.

12. Explain the function and purpose of the default drive.

The default drive is the drive that will be used by the commands unless you tell the OS to use a different drive. Default drives, like all defaults (values that the computer assumes unless you tell it otherwise) are designed to save typing, reduce confusion, and make the computer easier to use.

13. How can you tell which drive is the default drive?

The system prompt displayed on the screen is the default drive.

Use the command: prompt $p$g ,if the path prompt is not displayed.

14. Define default subdirectory.

The default subdirectory (a subdirectory allows a disk to be divided into areas that can hold files) is the subdirectory that will be used unless you tell the OS to use a different directory.

15. How can you tell which directory is the default subdirectory.

You can tell which directory is the default subdirectory by looking at the prompt. The term's directory and subdirectory are used interchangeably.

16. What steps must be done to change the default drive? Why would you change drives?

To change the default drive type the letter of the drive you want to change to followed by a colon. The default drive is changed. It eliminates the need to retype the default drive every time you give a file name.

17. What does A:\> mean?

The A: shows the default drive is Drive A: The path \ shows the default directory on Drive A: is the root directory. The > is insignificant, but useful, since it separates the prompt from the user's commands. Prompt is ready for new command.

Use the command: prompt $p$g ,if the path prompt is not displayed.

18. If you keyed in 10 commands and wanted to reuse a command previously keyed in, what could you do?

Use the up and down arrow keys to recall, or locate, commands used in a command prompt session.

19. What steps must be done to change a directory? Why would you change a directory?

To change a directory key in CD followed by the subdirectory name (path) you want to change to. The default subdirectory is changed to avoid having to key in the full directory name.

20. What is the significance of the first backslash in a command?

The first backslash always means the root directory while any other backslash is a delimiter.

21. Define global file specifications.

The symbols * and ?, also called wildcards, that are used to represent a single character (?) or a group of characters (*) in a file name.

22. How are wildcards used?

Wildcards allow you to specify multiple files at once in a single command. They can be used when you do not know the full name of a file, or if you want to refer to several files with similar file names or extensions.

23. If you see: C:\WINDOWS\SYSTEM32> ,on the screen, what does it mean?

What you see is the path prompt. It indicates that the default drive is C and the default subdirectory is \WINDOWS\SYSTEM32.

Use the command: prompt $p$g ,if the path prompt is not displayed.

24. What is the purpose and function of redirection?

Redirection allows files (or output/input from a command) to be directed to somewhere else (typically other commands, files, or the printer) rather than the standard output device (the screen).

25. What would you do if you forgot the parameter for a wide DIR display?

Key in DIR /? to get help with the DIR command.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download