7.03.2009

Command Prompt Navigation, Directories and Drives

Navigating the command prompt, as well as changing drives and directories is important skill to have. To do this, you must learn a few commands that you must enter into the command prompt

Navigating in the commandprompt is extremely simple. Remember to open your command prompt before trying to use this guide.

Changing directories

Changing directories (or changing your path) in the command prompt makes use of the CD command. The CD command has a small amount of possible arguments. CD accepts a drive and a path. For example, the command "CD C:\WINDOWS\system32" changes the directory to the system32 folder on the C drive. The letter C followed by a colon is the drive identifier followed by a separator respectively. All that comes after the colon is a path.

The CD command is relative to the directory you are already in, so you can navigate backwards to the parent folder. After entering "CD C:\WINDOWS\system32", you should be in the system32 folder. To reach the parent folder, WINDOWS, you can use the command "CD ..". You can also navigate to the root of the drive by using the command "CD \".

In the case that your desired folder or path has a space within it, you can encapsulate it in quotation marks.

If your drive/path combination is to a different drive than you are currently in, you need to add the /D argument to the CD command. For example, if I was currently in the A drive, and I wanted to go to navigate to C:\WINDOWS\system32, I would use "CD /D C:\WINDOWS\system32".

Listing directories

Directory and file listing and ordering can be done with the DIR command. Like the CD command, the DIR command is relative to the directory it is in and can also take paths. For instance, if I would like a list of all of the folders in C:\WINDOWS and I was currently in C:\WINDOWS\system32 I could enter "DIR "../"".

Results can also be listed using various order schemes. To change the way DIR orders the output, add the /O argument to it. The /O argument needs to be followed by a colon and a sortorder type. The available types are by name (n), by extension (e), directories listed first (g), by size (s) and by date/time (d). Using - as a prefix to one of the types reverses the output order. If I wanted to display all of the files and directories in the folder I was currently in using reverse alphabetical ordering, I could type "DIR /O:-n".

Read More...