JMU
Lab: Skills - Using the CMD Command Shell in Windows


Instructions: Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period it is strongly recommended that you complete it on your own.

1. Starting the Command Shell: This part of the lab will teach you how to start the CMD command shell in Windows.
  1. Click on Start, pull up to Run..., enter cmd.exe in the text field, and click on OK.
  2. In the CS Computer Labs, the shell prompt shows you the current (also called the working) drive and directory. The drive is the letter before the colon and the directory is everything after the colon.
  3. What is the current drive?


  4. What is the current directory?


2. Navigation Basics: This part of the lab will help you learn how to move around the file system.
  1. Change the current folder/directory to the root (i.e., top-most) folder/directory using the command:
    cd \
  2. Change to the \temp folder/directory using the command:
    cd \temp

    In this example, you used a absolute path because you entered the complete path, starting from the root folder/directory.

  3. Change to the parent folder/directory using the command:
    cd ..
  4. Change to the temp subdirectory folder/directory using the command:
    cd temp

    In this example, you used a relative path because you only entered the subdirectory name.

3. Basic Commands: This part of the lab will help you learn some basic commands.
  1. Make sure that your current drive and folder/directory is c:\temp
  2. Create the folder/directory named c:\temp\labs using the command:
    mkdir labs
  3. You just used a relative path to create a folder/directory. How could you have done the same thing using an absolute path?


  4. Change your current folder/directory to c:\temp\labs using the command:
    cd labs
  5. Check the prompt to make sure that you are in the right folder/directory.
  6. Get a listing of the contents of the current folder/directory using the command:
    dir
  7. What was displayed?


  8. This shows that there are no files in this directory. It also shows information for two directories, the current directory (which is referred to by .) and the parent directory (which is referred to by ..).
  9. Download the file teapot.txt to the folder/directory c:\temp\labs.
  10. Get a listing of the contents of the current folder/directory using the command:
    dir
  11. How big is the file teapot.txt?


  12. Make a copy of the file teapot.txt named teapot.bak using the command:
    copy teapot.txt teapot.bak
  13. Delete the file named teapot.bak by typing del t, pressing the Tab key (this is a feature called command completion), and pressing Enter.
  14. Re-copy teapot.txt to teapot.bak by pressing the UpArrow until the copy command appears (this is a feature called the command history) and pressing Enter.
  15. Get a listing of the contents of the current folder/directory using the command:
    dir
  16. How many files are in this folder/directory?


  17. Display the contents of the file teapot.txt using the command:
    type teapot.txt
  18. Delete all of the files that start with the letter "teapot." using the command:
    del teapot.*

Copyright 2013