Command Prompt Lab

advertisement
Basic Commands at a Command Prompt Lab
Objective: To execute basic commands at a command prompt
Parts: A Windows-based computer with command prompt access. The ability to save a file to the hard drive or flash
drive
Procedure: Complete the following procedure and answer the accompanying questions.
Note: For each step requiring a typed command the E n t e r key must be pressed to execute the command. This
instruction will not be given with each step.
1. Power on the computer and log on if necessary. When Windows loads, exit to a command prompt.
Windows Vista/7: (1) Start Search (Vista)/Search programs and files (7) textbox > type CMD > press Enter.
Does a prompt display? If not and you followed every step correctly, contact your instructor.
What prompt displays on the screen? This is the folder (directory) from which you are starting.
2. At the command prompt, type cd\.
The prompt changes to C:\>. If a message appears stating invalid command or invalid directory, you made a
typing error. If you suspect an error, verify the backslash is after cd and that there are no extra spaces. The
backslash starts from the left side and goes to the right (\). Other commands use a forward slash, which would be
in the opposite direction /.
cd is the command for change directory, which tells the operating system to go to a different directory in the tree
structure. The \ after the cd command tells the operating system to go to the root directory. An alternative way
of typing this command is cd \. Notice the space between the cd command and the backslash. There are usually
different ways to do every command from a prompt. Note that the cd\ command allows you to return to the root
directory at any time.
3. At the command prompt, type dir.
A list of files and directories appears. Files are the items that show an extension to the right of the filename, file
size, and file creation date. File extensions frequently give clues as to which application created the file. Directories
have a <DIR> entry to the right of the name.
List one file including its extension and one directory shown on the screen. Using Table
11.4 or the Internet, try to determine the application that created the file and write that
application (if found) beside the filename.
11
4. When the number of files shown exceeds what can be displayed on the screen, the files quickly scroll off the screen
until all files finish displaying. The DIR command has a switch that controls this scrolling. A command switch
begins with a forward slash and enhances or changes the way a command performs. At the command prompt, type
dir /p.
After looking at the data on the screen, press Enter again. Continue pressing E n t e r until the prompt reappears.
The /p switch (when used with the dir command, of course) tells the operating system to display the files one
page at a time.
5. At the prompt, type dir /w.
What is the function of the /w switch?
6. Multiple switches can be used with a DOS command. At the prompt, type the following command:
dir /w/p
Using the dir command /w and /p switches cause files to display in a wide format, one page at a time.
7. Different versions of Windows have documentation with online help. To find out the operating system version
loaded on the computer, type ver.
Who is the operating system manufacturer and what version is being used on the computer?
8. At the prompt, type dir /? | more. To create the vertical bar used in the command, hold down the S h i f t
key and, while keeping it held down, press the key directly above the E n t e r key. It is the same key as a
backslash. A short explanation of the command appears followed by the command syntax (instructions or rules for
how the command is to be typed). A technician needs to be able to understand command syntax to determine what
commands to type when unfamiliar with a command. The | symbol is called the pipe symbol. The | more
command tells the operating system to display the output one page at a time. Perform the following activities and
then press any key to continue until you return to a prompt.
Write at least a couple of options in the dir syntax.
Write one switch that can be used with the DIR command along with a short explanation of its purpose.
9. Type cd\XXXXX, where the XXXXX is replaced by the name of the directory you wrote as the answer to Question
3. For example in Question 3, if I wrote the directory name Casino,
I would type cd\Casino at the prompt. The prompt changes to the name of the directory
(folder) that I just typed.
10. Type the following command: dir a*.*
The a*.* is not a switch. This command is directing the operating system to list all files or subdirectories that
start with the letter A. The *.* part means all files. The directory you chose may not have any files or
subdirectories that start with the letter A. If this occurs, the operating system displays the message “File not found.”
The * is known as a wildcard. A wildcard substitutes for one or more characters. The first asterisk (*) is the
wildcard for any name of a file. The second asterisk is the wildcard for any extension.
Does the operating system list any files or subdirectories that start with the letter A? If so, write one of them in the
following space. If not, did the operating system let you know this? If so, write the message displayed.
11. Type the following command: cd..
The .. tells the operating system to move back (or up if you think about the structure in Windows Explorer) one
directory in the directory structure. Since you are one level down (because of typing the cd\XXXXX command),
this command returns you to the root directory.
If you wanted to display a list of all files in the root directory that start with the letter C, what command would you
type? Try the command you think is right on the computer to see if it works.
Do any commands start with the letter C? If so, write at least one of them down.
Does the COMMAND.COM file appear in the list of commands that start with the letter C?
On Your Own
a. Change to the directory that contains Windows. The directory name is normally Windows or WINNT. If you cannot
determine what directory contains Windows, use the dir command again or contact your instructor or lab
assistant.
Write the command you used to do this.
List two Windows files that begin with the letter D.
b. Return to the root directory.
Write the command you used.
12. Note: If you are not allowed to create and save a file on the hard drive, you can do this part from the root directory
of another drive such as the floppy drive or a flash drive.
From the root directory of whatever drive you are using (designated as X:\), you are going to create a file using the
copy con: command that will later be read using a different command. The name of the file will be
LadyVOLS.txt. You are going to type the commands below exactly as they appear and at the end of each line press
Enter. Note that no message appears. For example, if your flash drive is the E: drive, your first line
will be copy con: E:\LadyVOLS.txt and you will press the E n t e r key. Continue typing as directed.
copy con: X:\LadyVOLS.txt Enter
This is a fine mess you’ve gotten me into Ollie. Enter
This computer is about to EXPLODE if you press Enter one more time. Enter
Go get that Earth creature and bring back the Uranium Pew36 Space Modulator.
Enter
Can you sing Rocky Top? Enter
Press F6 . ^Z (caret Z) appears on the screen. Press Enter. A message appears stating that one file copied. If this
did not occur, repeat this step.
13. From the root directory, use the TYPE command to view the text file you just created by using the following
command: type ladyvols.txt
What is the result of using the type command?
Can you edit and change the file using this command? [ Yes | No] .
14. The DEL command is used to delete files. From the root directory, delete the file you just created using the
following command: del ladyvols.txt
Why do you think you did not have to type del x:\ladyvols.txt (the full path) in the last step?
11
Download