DOS lives! Secrets of the Windows command prompt

Don't be afraid of a little typing. Lots of good old DOS commands still work in Windows, and often they're the best choice for quick and efficient work.

1 2 3 4 5 6 7 8 Page 2
Page 2 of 8

Before you dive in, a warning: Using the command prompt isn't easy. My book DOS for Dummies didn't sell 25,000 copies a week when it first came out in 1991 because of its lively plot, vivid character development or suspenseful ending. What made that book a page-turner was its ability to express to normal humans how the text mode of a computer operates, which is not always easy to figure out on your own.

The lowdown on DOS directories

clear.gif

To use the command prompt effectively, we first need to review the concept of directories.

Microsoft made great efforts in the 1990s to change the old nomenclature from "directory" to "folder." For a GUI like Windows, that's OK, but the command prompt uses directories as DOS did.

The prompt is configured to show you which directory you're currently using -- most of the time. If you're not sure, type

CD

and hit Enter.

On my computer, the prompt

C:\Users\Dan>

indicates that I'm currently using, or logged to, the directory Dan, a subdirectory of Users, a subdirectory of the root directory on drive C.

That means that commands issued affect only the files in the Dan directory, unless you specify an alternate pathname, which we discuss below.

To refer to or use files in another directory, you have two choices. First, you can change directories by specifying the full pathname to the files. For example:

C:\WINDOWS\WEB\WALLPAPER\IMG10.JPG

Or you can use the CD, change directory, command to log to that specific directory:

CD \WINDOWS\WEB\WALLPAPER

You'll see the command prompt changed to reflect the new location:

C:\Windows\web\wallpaper>

If you're familiar with Unix, you'll note some similarities (and also many differences) between the way it handles directories and how DOS does things. First, DOS uses the backslash to separate paths. (DOS can use forward slashes, but their behavior is inconsistent, so it's safest to stick with the backslash.)

Second, typing CD by itself in DOS does not return you to your home directory; it only shows you where you currently are. In Windows, you must do that manually by entering the pathname as we discussed above, or use this trick:

CD %USERPROFILE%

In Windows, USERPROFILE is an environment variable representing your home directory. When used at the command prompt, environment variables must be enclosed in percent signs so that they expand properly.

Finally, DOS and Windows handle separate storage devices as unique drive letters. So to use drive D in DOS, you must log to it by typing its drive letter and adding a colon:

D:

Drive D and other drives also have their own file system, which you can navigate by using the CD command. Each drive has a current directory, and to discover what it is, use the CD command followed by the drive letter and a colon:

CD D:

The above command reports the current directory on drive D.

Now that you know where you are, directory-wise, let's have some fun.

clear.gif
clear.gif
1 2 3 4 5 6 7 8 Page 2
Page 2 of 8
7 inconvenient truths about the hybrid work trend
Shop Tech Products at Amazon