Often the very mention of the
command (or DOS) prompt can send people into spasms of fear and
that’s understandable, it’s an area that’s rarely used and there
aren’t any comforting prompts to help you along.
Why?
But the command prompt can
be your friend. You may run into a situation where Windows just
won’t start and your only recovery is via the command prompt.
Many times Windows will tie up files and not allow you to manage
them in Windows. At that point the only way you can access them
is without Windows running.
What It Is
The command prompt is the
precursor to Windows and was the primary interface for millions
of computer users for years. In fact when it was introduced it
was quite a leap forward from the finger blistering practice of
flipping actual switches on a computer’s front panel (computers
not always being as powerful as they are today!).
When the computer starts, it
loads a number of programs that extend the capability built into
the hardware. One of these programs is command.com, which is the
actual command processor.
Among other things
command.com processes input from the keyboard and decides what
to do with it. First it looks at its internal commands, also
called intrinsic or internal commands that are built right into
command.com. If it doesn’t find the command internally it
searches the path for a file with the same name with the
extension .com, .exe or .bat. If the command processor can’t
find an internal process or a program in the path with the name
you typed in, it’ll return the friendly message “Bad command or
filename”. Be prepared to become close friends with this
message. Typos or calling for a program not in the current
directory or the path will return this message.
Path?
Ah, the first quirky thing
about the command processor, it has a fixed area where it can
search for an external file and this is called the path. These
are the drives and folders where it’s been told it can expect to
find files in. Let’s start out by using the first internal
command and reveal what the path is.
Start a command prompt
session by clicking on the icon or click start, run and type in
command. The command prompt window should start up and you
should have a prompt like so:
C:\windows\desktop>
What you see may be
different, don’t be concerned if it is. The above means that the
current folder is the desktop folder inside of the windows
folder on drive C:. This is the second place that the command
processor will look for a program name to match what you’ve
typed in (the first being an internal command)
At the command prompt type:
Path
And hit the enter key. You
will see a list of the folders and drives that command.com will
process when you type something. On my computer it looks like
this:
Path=c:\windows;\c:\windows\system32
Again, this may be different
on your computer. The above means that when I type in something,
command.com will first look for an internal command, then in the
current folder (c:\windows\desktop) and if it doesn’t find it
there it’ll look in c:\windows and then c:\windows\system32
Navigating
If you wish to change to
another folder (also known as a directory) you can use another
internal command.com command called change directory via the
command cd. Go ahead and execute the following command:
cd\windows\system32
and hit the enter key. The
prompt should change to c:\windows\system32
Bingo! You’ve just navigated
via the command prompt.
Running Programs
Now
that you’re in the \windows\system32 folder you can run any of
the programs in that folder (or also in your path) but let’s see
what’s there first by requesting a directory of the folder. At
the command prompt type:
dir
and hit the enter key.
You’ll see a listing of all the files in the c:\windows\system32
folder along with some detail on file size and creation date and
time.
Let’s run an actual program.
At the command prompt type:
chkdsk
and hit the enter key. This
runs the program chkdsk.exe, which is just an old style version
of scandisk.
Other Internal Commands
There are a bunch of other
internal commands beyond the three we’ve just used including mem, copy, delete, cls, time and exit as well as a lot more. You
can’t hurt anything typing in any of the above so give them a
try. Some will give you results you can actually see while
delete and copy will just tell you that required parameters are
missing, but typing them in will give you a sense of how things
work and get you comfortable. Next session we’ll take up the
details of copy and delete and get down to some real work.
Oh, and to close the command
window? Type exit and hit the enter key.
Until next month best in
computing.
Go to part 2.
Back
to article index