Moving around in DOS
There are basically only
two things you need to move around inside: Drives and Directories (folders). Both have their own particular commands.
Changing Drives
Drives can be
physical drives inside your computer and are represented by letters of the alphabet (i.e. the A:Drive = floppy disk, C:Drive = hard disk, etc.) or they may be
mapped drives (a shared folder on a network which has been
mapped to your system using a spare drive letter, such as
S:).
So under MS-DOS, a drive is represented as a
drive letter, followed by a
colon, thus:
C:
You can only be logged onto one drive at a time and this is represented by the drive letter, followed by a colon, followed by the directory you are inside, followed by a 'greater-than' symbol, thus:
C:\>
So in the above example, we are logged onto the C: drive, in the root directory. The
root directory of a drive is the highest point you can navigate to or put another way, it is when you are not in any other directory (see below). It is represented under MS-DOS by the backslash symbol \. Together all of these symbols are collectively known as the
Command Prompt and it is here that you type your DOS commands.
To change to another drive, at the command prompt simply type the new
drive letter with a colon and then press the
enter key:
C:\>
E: [ENTER]
E:\>_
Changing Directories
Directories are to DOS what folders are to Windows. They're the same thing. The basic command to change a directory is
CD (Change Directory). Like all DOS commands, you type a
space after the command and then the name of the file or directory which you want the command to work on.
You can think of a computer's file system as being like an upside-down tree: the
root
is at the top and the folders and files flow downwards like branches. The term
Root or
Root Directory refers to the
top of the tree - you can't go any higher. As already mentioned, it is represented by a backslash
\. So to reiterate, if I'm in the root directory of drive
C: the command prompt looks like this:
C:\
To
change to a
directory (and thus move down the tree) I type
CD, space
and the
name of the
directory:
C:\>
CD Windows [ENTER]
C:\Windows>_
The command prompt now shows me I am in the Windows directory on drive C: To change to
yet
another directory within the
Windows directory, I can type
CD again followed by a space and the name of the next directory:
C:\Windows>
CD System [ENTER]
C:\Windows\system>_
Note DOS
is not case sensitive. To
change back to the
root directory (top of the tree), I type:
CD\ Thus:
C:\Windows\system>
CD\ [ENTER]
C:\>_
If I knew I wanted to go straight to the
System directory nested within the
Windows directory, I could type the whole
path in at once:
C:\>_
C:\
CD Windows\System [ENTER]
C:\Windows\system>_
Paths
A
path or
directory path is a way of pointing to a file, in a directory, on a certain drive:
S:\cert3it\pcops2\dos\hello.txt
In the above example of a path, the file
hello.txt is inside the
\dos
directory, which is inside the
\pcops2 directory, which is inside the
\cert3it directory, on the
S: drive. In order to get to the file hello.txt, you have to follow the above path.
Moving onwards..
To
move back (or up the tree)
one directory at a time, you use the
CD..
command:
C:\Windows\system\help>
CD.. [ENTER]
C:\Windows\system>
CD.. [ENTER]
C:\Windows>_
******************** Avoid these common mistakes ********************
You
cannot use the
CD command to change to another drive (i.e. 'CD S:')
You
cannot change to a different
drive and folder in the same command (i.e. you can't go from
C:\Windows to
S:\cert3it in one hit).
************************************************************************
To change to a
different directory on a
different drive, you must log onto a
different drive first, and then
change directory:
C:\Windows>
S: [ENTER]
S:\>
S:\>
CD CERT3IT [ENTER]
S:\CERT3IT>_
Using these basic DOS commands, you can move around all the
directories and
drives
on your system like a pro. People will be impressed.