DOS is an acronym that stands for Disk Operating System and was the base for Windows Operating systems until Windows 2000 when Windows NT took over. When you boil any windows os down you get dos eventually. DOS, cmd.exe, or command prompt — three terms that are not all mutually exclusive — is a very powerful tool when combating viruses, formatting your hard drive, or simply copying files and folder from one directory to another.

Please note: directories are different in XP and those examples will be clearly indicated with a line below the Vista and Windows 7 directories. So if you're a faithful XP user, your command line is below the divider.

Note: All commands used in this tutorial series work on XP, Vista, and Windows 7.

In this tutorial, we will be going over basic DOS navigation commands. So let us begin already!

C:\> is how we often identify CMD from something like Windows Power Shell or a Unix Terminal.

Power Shell

This is an example of Windows Power Shell explaining foreach loops

Why would we use CMD?

There are a number of reasons why we would use CMD. Often, we use CMD to view network statuses, open Windows Utilities like System Configuration, or to delete stubborn files that we cannot delete normally.

Note: if you are using Vista or Windows 7, you will need to open cmd.exe as an administrator. This is called an elevated cmd where you start in the System32 directory and cmd.exe has full admin privileges.

Navigating Through DOS

Navigating through the command prompt is very easy and powered mostly by one simple command: cd.

cd or chdir stands for Change Directory. This allows us to change directories (or folders) in DOS. For example:

Let us assume we just opened the command prompt and we wish to navigate to the root directory of our C: drive. In order to do this we would do the following:

cd C:\


This is telling DOS to change the directory to C:\ or the root directory of the Hard Drive.

Using a bit more complex directories, we can navigate to our music folder from the root directory (C:\>)

C:\> cd C:\users\dennis\music - VISTA/7
C:\> cd C:\documents and settings\dennis\my documents\my music -XP


Note: when using CMD, the commands and any text you write are NOT cap-sensitive. There is no difference between CHDIR and chdir, they both will work.

If we got lost in here, fret not. This brings us to our next command which is dir which stands for directory. A directory is any really just any old folder on your hard drive. This could be the Windows directory, the System32 directory, or the Music directory.

The dir commands shows us all of the directories and files within the directory we are in. Let us assume we're back in the root directory of our C: drive and we want to see all files and folders within the C: directory we would simply type:

C:\> dir

dos dos

We can see that there are many folder within the root directory of our C: drive. The Windows folder contains our operating system, the user folder contains out user accounts and personal files, and the Program Files contains all of our applications.


If you are familiar with programming then you are familiar with functions (methods for those java programmers). In DOS we have what are called switches. These switches or arguments, allow us to have a command do something specific or only do part of the command. For example,

dir |more
dir /4
taskkill /im iexplorer.exe /f
erase C:\windows.old /f
rd C:\windows.old /q /s

The forward slash / designates the switch used for the DOS command.

The most important switch of all

By far the most important switch to know is /?. Confused a little? The /? switch allows us to get help with any command. Using this siwtch on a command will show us the syntax, all of the siwtches that can be used, and often it will show examples of the command in use. For example,

dir /?


Using this switch, we can figure out all other switches and easily determine what we need to do. If, for instance, we wanted to show the directories and files that end with .sys except, we want them in alphabetical order, we would do the following:

dir *.sys /on

This will find all files that end with .sys and place them in alphabetical order. The switch /on can be separated into two components first.

/o /n
Enables the sortorder switch. This allows you to sort the order of the directories you are searching through The subswitch — so to speak — is like an extension of the sortorder switch. Since it's a subswitch, we can negate the / before the n.


You may have noticed the asterisk before the .sys. This is called a wildcard. If you've ever done programming of any kind of are proficient in CSS, then you may have encountered this wildcard before.

Basically, a wildcard is something that allows you to do something or apply something to multiple things without having to define them all directly. This can be important when navigating through DOS. If, for instance, we're looking for a .exe file but we don't know the name of it or even if you know part of the name, then we can use the wildcard to find it. COnsider the following:

C:\users\{username}\documents\pictures> dir n*.jpg

This will search through the entire picture folder for images that start with n and end in .jpg.

Question Mark Wildcard

The question mark is another form of wildcard with DOS. The difference is the number of character that can be used for each wildcard. The Asterisk (*) will allow up to an eight character substitution and the question mark (?) will allow for a single character substitution. For example,

C:\Windows\System32\> dir x*.e?? /on

This would search for any files and directories that begin with "x" and end with the file extension that starts with an "e". These results would also return alphabetically via the switch "/on" as mentioned before.

Be Sociable, Share!