WINDOWS COMMAND PROMPT

LESSON – INTRO & NAVIGATION

 

separator-blank.png

 

GROUP WORK

 

STEP 1 – CMD

 

·       Type cmd to run the Command Prompt.

·       Or, you can find Command Prompt listed in the programs in your Start menu.

·       Or, you can double click on the cmd.exe file located in C:\Windows\System32.

 

STEP 2 – TERMINOLOGY (CLI – COMMAND LINE INTERFACE)

 

·       The Command Prompt is the Command Line Interface (CLI) for Windows.  A command line interface is a way to interact with the operating system using text-based commands.

 

STEP 3 – TERMINOLOGY (PROMPT & CURSOR)

 

 

·       At the bottom of the writing on the screen, you will find the active prompt.  The prompt specifies your current location in the file system.  The small line to the right is your cursor.  When you start to type, the corresponding characters appear at the cursor.

 



STEP 4 – TERMINOLOGY (DRIVES)

 

·       In Windows (and in DOS beforehand), all drives are given a letter.  The main drive on which Windows is installed usually gets the letter C.  Drive letters are always written with the letter and a colon.  For example, the C drive is written as C: and the D drive is written as D:.

 

·       Drive letters are given to all types of drives including HDD, SSD, CD-ROM drives, DVD-ROM drives, older floppy disk drives as well as USB keys.

 

STEP 5 – TERMINOLOGY (PATH)

 

·       The prompt is actually giving you the path to the current location in the file system.  In Windows, a path starts with the drive followed by the subfolders separated by a backslash (\).

For example, if the path is
C:\Users\campeap, then that refers to the location on the C drive inside the subfolder Users and then inside the subfolder campeap.

 

STEP 6 – TERMINOLOGY (DIRECTORY)

 

·       In Command Prompt, instead of the word folder, we use the word directory.

 

STEP 7 – DIR

 

·       Use the dir command, which is short for directory, to see which files and subfolders are located in the current location.

·       Analyze the output.  You should be able to figure out the following:

o  How many files and subfolders are there?

o  What is the total size of the files in the current location?

o  What is the size of each file?

o  Which lines refer to folders and which ones refer to files?

o  What is the order of the listing?

 

STEP 8 – CD

  • The cd command, short for change directory, allows us to change the current directory.

  • Use cd dirName where dirName refers to a subdirectory of your current location.

    Notice that the prompt is updated with the path of the new location.

 

STEP 9 – CD ..

·       Try cd ..

Notice that it brings you up one level in the directory structure.  You are now in the parent directory.

 

 

STEP 10 – DIR WITH PATH

 

·       The dir command can be used with a path to see the files and directories at the location of that path.  This allows us not to have to change to a directory to what is in it.

Try these:

    dir C:\Windows

    dir C:\Users

    dir C:\

 

 

STEP 11 – CD WITH PATH

 

·       We can immediately switch to a specific location by simply providing the path with the cd command.

Try these:

    cd c:\

    cd c:\windows\system

 

STEP 12 – CONCEPT (DESKTOP DIRECTORY)

 

·       Your Desktop is actually a directory like all others.  It is only special because it gets displayed automatically.

·       You can find your Desktop directory in C:\users\username where username is the username of your current account.

·       If you are using the program One Drive to automatically back up your computer, then your Desktop directory is located at C:\users\username\onedrive.

 

STEP 13 – TERMINOLOGY (ROOT)

 

·       If your prompt states only the drive letter, then you are in the root directory or simply at the root of that drive.  This is the top level of that drive.

 

STEP 14 – CONCEPT (CHANGING DRIVES)

 

·       We can navigate any drive.  To switch to a specific drive, we simply type in that drive’s letter and colon.

·       If you have a USB key, plug it in.  Windows will give it a drive letter.  Then, in Command Prompt, you can go to that drive.

 

 

STEP 15 – TERMINOLOGY (SWITCH)

 

·       Most commands can be modified by using a switch.  Switches allow the user to make the commands work in a different way.

STEP 16 – USING SWITCHES

·       Try typing the following command and switch:
 

dir /w

 

Above, the command is dir and the switch is /w.  The /w makes the dir command use the wide output instead of the standard output.

·       To see a list of all possible switches for a command, try using:

        
dir /?

 

·       Try using a few different switches with the dir command.

 

STEP 17 – TREE

 

·       Try typing the following command:

        
tree

 

It creates a nice visual tree of all of the subfolders of your current location.

Note that you might want to do this in a location that doesn’t have too many subfolders or this might take a while.  (See the next section if you need to stop a command because it is taking too long.)

 

 

STEP 18 – CONTROL-C

 

·       If a command is taking too long to run, you can cancel it by hitting the keys CTRL-C.

·       You can test this out by going to the root folder (C:\) and typing in the tree command.  Then hit CTRL-C to end it.

 

STEP 19 – UP ARROW

 

Trying hitting the up arrow.  It brings up past commands that you types.  This is very useful to speed up your work in DOS. 

 

In the real DOS, this functionality was not built-in, but rather provided by a program called doskey. 

 

STEP 20 – COLOR

 

·       Try the following:

         
color 01

 

·       To understand what the 01 does, type in the following

 

                    color /?

 

STEP 21 TITLE

 

·       To change the title in the CMD Window’s title bar, try:

 

                    title Fun in Command Prompt

 

STEP 22 – CONCEPT (CMD IN ADDRESS BAR OF FILE EXPLORER)

 

In File Explorer, you can go to any location and type cmd in the address bar to immediately open the command prompt at that location.

This avoids having to navigate to a specific location after opening command prompt regularly.


Try it!

 

separator-blank.png