Download software, read reviews, get tips and support.  
Home   Articles   Forum   Reviews   Downloads   About/Contact

  PC-Net's PC News
 
Don Watkins

Take Command of the Command Prompt - The Command Prompt. What It Is and How To Use It. Part I

By Don Watkins

 
 
 

 

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

 
     
   
  PCNet privacy policy    Copyright, 2010. pcnet-online.com