Hey, this is a really useful subject! Well, to redirect something means
to take something that was supposed to come from or go to a certain place
and take it from or send it to a different place instead. STanDard INput
(called STDIN for short) usually comes from the keyboard, so input redir-
ection means to make the input come from somewhere else instead. STan-
Dard OUTput (also called STDOUT) usually goes to the monitor, so output
|nredirection|n means to make the output go to somewhere else instead. Pret-
ty simple concept, huh?
For input |nredirection|n, the symbol is <. For example, suppose you want to
delete a whole directory full of files, from within a batch file. If the
|nbatch file|n gives the command |nDEL|n C:\TEMP\*.* then the DEL command's going
to ask "Are you sure? (Y/N)" and sit there waiting for Y or N input from
the |nkeyboard|n. Well if you know that the answer to that question is def-
initely going to always be Y, then you can create a little file on your
disk that contains nothing but a Y and carriage return (the
and name that file Y.TXT, and make the STDIN for that question come from
that file instead of from the keyboard, and then the batch file can con-
tinue on its merry way without your having to press a Y or N key, like
|nDEL|n C:\TEMP\*.* < Y.TXT
Of course the DEL part has to come first, because that's the name of the
command, so in order to get Y.TXT pointing toward the command, use the <
symbol. Now when the |nDEL|n command tells DOS that it wants some STDIN from
the |nkeyboard|n, DOS is going to give the input from the Y.TXT file instead,
because the |nDEL|n command won't know the difference as long as it gets some
Another time that input |nredirection|n is really useful, is with the MORE
command. This command takes STDIN and sends it to STDOUT 23 lines at a
time. That doesn't do much good at all unless STDIN is redirected from
somewhere else besides the |nkeyboard|n. You can read a long text file one
page at a time, with this command:
|nMORE|n < FILENAME.EXT
Notice that the < symbol causes the file to be pointing toward the MORE
command. If you were to accidentally type the > symbol instead the |nMORE|n
command would send STDOUT to the file, instead of taking STDIN from the
file, and that would effectively erase every byte of data from that file.
Make sure the symbol points from the file toward the command!
Now make sure you understand that once you redirect STDIN from somewhere
toward a command, that command is not going to accept any input from the
keyboard, because it's taking all of its input from the place you redir-
ected it from. If a command takes some input and then does something and
then asks for some more input, that second piece of input has got to be
in the same place that the first piece was in, or else the command will
sit there all day waiting for the second piece of input to come from that
same place. The command won't pay the slightest bit of attention to the
|nkeyboard|n, because you told it to take its input from somewhere else. So
make sure that if you write a little file like Y.TXT for a purpose that
requires more than one piece of input, that you put all the input that
will be needed for the entire command, into that file.
For example, the FORMAT command asks you first to place the disk into the
drive and press
were to make a file that contained just a carriage return, and you used
the command |nFORMAT|n A: < CR.TXT to redirect that file into the |nFORMAT|n com-
mand. Well it will start out working just fine, but when the formatting
is done |nFORMAT|n is going to ask you "Format another? (Y/N)" and it's going
to sit there forever waiting for the Y or N to come from that CR.TXT file
and the only thing you can do about it is reboot the computer. Run the
command a few times first, to make sure you know exactly what input the
command is going to want, before you create a file to redirect into it!
(The DOS version 5 |nFORMAT|n command is not a good candidate for input re-
direction, because under different circumstances it will ask for differ-
ent input. For example, if a disk doesn't have enough free space on it
for the |nMIRROR|n.FIL file, then |nFORMAT|n will ask if you want to format it
anyway, even though it won't be |sUNFORMAT|stable, so your little text file
won't be able to deal with that question if it comes up!) It won't mat-
ter if the text file being redirected into a command has too much data in
it, as long as all the data the command is going to need is there and in
the right order. You can put fifty extra characters into the file if you
want, and nobody will care, as long as they come after the parts that the
command is going to want.
The MORE command requests the data that it is to display, from the STDIN
device, so if the STDIN has been redirected from somewhere other than the
the keyboard, then that's where |nMORE|n will take its input from. But for
the keystroke that tells |nMORE|n to display the next screenful, |nMORE|n doesn't
request that particular piece of input from STDIN, it looks right at the
|nkeyboard|n instead, for that piece of input. So that's why you can still
"press any key to continue" even though STDIN has been redirected. But
for any command that takes all of its input from STDIN, then in that case
the |nkeyboard|n will be totally ignored when input is redirected, until that
particular command completes and exits back to DOS.
Another use for input |nredirection|n is when you've temporarily disabled CON
(that's the name for the CONsole device which means monitor-and-|nkeyboard|n)
with the CTTY command, and you need to take just one little piece of in-
put from the keyboard. For example, PAUSE < |nCON|n so that you will be able
to use the |nkeyboard|n to "Press a key when ready . . ."
Output |nredirection|n is even more useful! You can take all the stuff that
a command usually sends to STDOUT, and send it to a file, or to a print-
er, or to your modem, or even to a place called NUL which means nowhere.
Now this will not effect STDERR, which means the place where a command
sends ERRor messages to. Those will still go to the monitor, even when
STDOUT is redirected elsewhere. But little messages like "1 File(s) cop-
ied" can be sent to |nNUL|n so you don't have to look at them on the screen.
The output of the MEM command can be sent to a printer so you can take it
over to your friend's house, and show him how much free memory you have
now that you installed DOS version 5. The entire output of the CHKDSK
command can be sent to a disk file so that you can look at it later. But
you have to watch it with that one, though, because that does mean the
entire output. If |nCHKDSK|n runs into any errors on your disk, it will send
the message about "Convert lost chains to files? (Y/N)" to the disk file
where you won't be able to see it. You won't even realize that |nCHKDSK|n is
sitting there waiting for you to answer the question. You can say Y or N
or you can say
take you a minute to realize that you need to do such a thing. Of course
you'd better use the
question |nCHKDSK|n is waiting for an answer to. Well here are the commands
you would use to perform those tricks:
|nCOPY|n FILENAME.EXT D: > |nNUL|n
|nMEM|n /C > |nPRN|n
|nCHKDSK|n C:*.* /V > FILENAME.EXT
See, the little arrow points in the direction in which you want the flow
to occur. We're sending output away from the command and toward the file
or toward the device|1s, so we're using the > symbol.
Make sure you understand that if the recipient of the > symbol is a file-
name, and there already exists a file by that name, whatever that file
contains is going to be irrevocably lost the second you hit the
key to execute that command. Because whenever DOS sees an output redir-
ection symbol, the very first thing that happens is that DOS opens the
file that's referred to in the command, and dumps the contents of that
file into the "bit-bucket". (That's just an expression that basically
means trash can. Remember, a bit is an eighth of a byte, which is the
amount of data taken up by one character.) Whenever the > symbol points
toward a filename, the file is created if it doesn't exist already, or if
it does exist, it is erased. Wiped out. Immediately. Before DOS even
looks at the rest of what you typed on that command line. Also, if there
doesn't end up being any STDOUT directed toward that file, the file will
still exist because DOS created it as soon as you hit the
For example, if you typed |nDEL|n FILENAME.EXT > TEST, then the file named
TEST will be created even though there is no output from a command like
|nDEL|n FILENAME.EXT. TEST will just be a zero-length file, but it will have
a directory entry even though it won't take up any disk space.
If a file already exists and you want to add some more data to it, you
can use a double >> sign, like this:
|nMEM|n /C >> MEMCHKS.TXT
Whenever DOS sees a double >> sign, that means to create the file if it
doesn't already exist, or add more data to the end of the file if it does
already exist, which is called appending the data to the file.
Now all these |nredirection|n examples so far have involved one command and
one device or filename. What if you want to redirect one command to an-
other? That's what the third type of |nredirection|n is for. It's called
piping and it uses the pipe symbol which looks like ||. That's the char-
acter on top of the \ key, so if you hold down a
you'll get || and that's a pipe. Piping takes the output from the first
command on the command line, and sends it as input to the second command
on the command line. For example,
|nCHKDSK|n C:\*.* /V || |nMORE|n
That takes the output of the CHKDSK command that would normally be sent
to your screen at about a million miles per minute, and sends it instead
as input to the MORE command. The |nMORE|n command takes its input and div-
ides it into 23-line sections, and sends each section to the screen with
a "-- More --" symbol at the bottom, which means you should press a key
when you're ready to see the next screenful of output.
Remember, you can't use pipes with filenames or device|1s, only commands.
Piping sends STDOUT from one command as STDIN to another command. And
you can't put a command to the right of a > or < symbol. The only thing
that goes to the right of those symbols is a device or filename.
Here's another useful example. Remember how you can use a command like
|nDEL|n C:\TEMP\*.* < Y.TXT to make the DEL command work without waiting for
you to say whether you're "sure" or not? Well that requires that you
have a little file named Y.TXT which contains a Y and a carriage return,
sitting on your disk taking up an entire cluster of disk space. This
command will serve the same purpose, without that Y.TXT file:
|nECHO|n Y || |nDEL|n C:\TEMP\*.*
The output of this ECHO command is a Y and carriage return, so with the
pipe, that gets sent to the |nDEL|n command whenever |nDEL|n gets ready to ask
for its input. Now you can get rid of your Y.TXT file that's taking up
all that disk space!
The only problem with piping is that DOS needs to borrow some disk space
to create some temporary files, whenever you use piping. If your current
disk doesn't have enough room, or if you're on a network and you don't
have write access to the |ncurrent|n drive, or if you have a write-protect on
the |ncurrent|n disk, then DOS won't be able to perform the piping operation.
Also, if you should use the
mand, or if you have a power outage in the middle of the command, then
those little temp files will get left on your disk, for you to wonder
later where they came from.
If you have DOS version 5, you can set an environment variable named TEMP
which will tell DOS where you want those temp files created, instead of
in older versions of DOS, the temp files were created in the |ncurrent|n dir-
ectory of the |ncurrent|n drive. No more! If you have a RAMdisk with E: for
a drive letter, put these commands into your AUTOEXEC.BAT file:
Now whenever DOS does any piping, it will put those temp files onto the
RAMdisk. That's great for two reasons. First, a |nRAMdisk|n is so much fas-
ter than any other type of disk, so piping operations will be faster than
they would be if TEMP was not set or if it was set to a slow hard disk.
Second, if you have a power failure in the middle of the command, you
won't have to go and erase those little temp files because when the |npower|n
went out, everything on the |nRAMdisk|n, including the little temp files, was
Even if you don't have a |nRAMdisk|n, if you have DOS version 5 you should
use a |nSET|n TEMP=C:\SOMEWHERE command in your AUTOEXEC.BAT file, so that
your temp files all end up in the same place, instead of being scattered
all over the place depending on what drive and directory you happened to
be in at the time you performed a piping operation. Of course, if the
operation is completed properly, DOS will delete the temp files all by
You can also combine more than one |nredirection|n character in the same com-
mand. For example:
|nFIND|n "Hello" FILE1 || |nSORT|n /+3 || |nMORE|n
|nCHKDSK|n C:\*.* /V || |nFIND|n "WHAT" > |nPRN|n
|nFORMAT|n A: < FMT.TXT > DISKSIZE.TXT
But except for the pipe symbol, you can't use more than one of the same
symbol in the same command. For example,
|nDIR|n > FILE1 > FILE2
will not send the output of the DIR command to both of those files!
There is a type of command called a "filter", which takes STDIN from the
keyboard and performs some function on it, and then sends STDOUT to the
screen. Filters don't really do anything useful unless they're used with
some |nredirection|n. FIND, MORE, and SORT are the filters that come with
DOS, although the |nFIND|n filter is easier to use as a regular command in-
stead of as a normal filter. That means, use it without the < symbol.
You can also use |nredirection|n to create an empty file or a non-empty file.
Remember that as soon as DOS sees the > symbol, if there's a filename on
the other side of that symbol then the specified file gets created, be-
fore DOS even looks at the rest of the command. So if you do not have a
file named FILE1 and you execute this command:
|nTYPE|n FILE1 > FILE1
then DOS creates a file named FILE1 and so far it's empty, but it does
exist. So then DOS types out the contents of the FILE1 file (nothing),
and sends that output (nothing) to the FILE1 file. So FILE1 still con-
tains nothing. You just created a zero-length file which takes up a
directory entry, but no disk space gets used because the file is empty.
You can use the ECHO command to create a non-empty file like this:
|nECHO|n HELLO > FILE2
|nECHO|n HOW ARE YOU >> FILE2
DOS creates a file named FILE2 and the |nECHO|n command puts the word HELLO
and a carriage return into that file. The next command opens the FILE2
file again, and sends the words HOW ARE YOU and another carriage return,
to the end of the file.
If you're absolutely positive that the last line in your CONFIG.SYS file
ended with a carriage return, then you can add a new line to the end of
it without even editing it. Like this:
|nECHO|n DEVICE=C:\DOS\ANSI.|nSYS|n >> C:\CONFIG.|nSYS|n
But if the last line in the CONFIG.SYS file were STACKS=0,0 and that com-
mand didn't have any carriage return at the end of it, then the result of
that ECHO command would be this:
all on one line like that, and DOS wouldn't appreciate that command very
well the next time you reboot the computer and DOS tries to execute the
commands in your |nCONFIG.SYS|n file. That's a good reason to make sure that
each command in your |nCONFIG.SYS|n file, or any batch file, ends with a car-
riage return (the
You can use input |nredirection|n to make script files for commands such as
EDLIN and DEBUG. If you upgraded from DOS version 3.2 to 3.3, and wanted
to change the first line of each |nbatch file|n from |nECHO|n OFF to @ECHO OFF,
you could create a little text file named |nEDLIN|n.TXT like this:
and then use this command:
|nFOR|n %a IN (*.BAT) DO |nEDLIN|n %a < |nEDLIN|n.TXT
And automatically, right before your very eyes, all your batch files will
be updated to include the @ symbol which didn't appear in DOS until ver-
sion 3.3. Here's how it works. The FOR command causes DOS to repeat the
command that's written after DO, for each file that matches the specifi-
cation in parentheses. So for each .BAT file in the current directory,
DOS will perform the command |nEDLIN|n WHATEVER.BAT < |nEDLIN|n.TXT. That will
load the EDLIN line editor and the WHATEVER.BAT file, and then instead of
taking STDIN from the keyboard, |nEDLIN|n will take its input from the file
you created named |nEDLIN|n.TXT, which contains all the commands |nEDLIN|n needs
to change line one of the file to @ECHO OFF, and then save the changed
file to disk, and exit back to DOS. Then DOS will continue on with the
|nFOR|n command, with the next .BAT file in the |ncurrent|n |ndirectory|n, until they
have all been edited. From now on, whenever you run your batch files,
you won't see that ugly old "|nECHO|n OFF" command flash onto the screen, be-
cause what the @ symbol does is it tells DOS not to display the command.
That's just about the best thing about EDLIN, even though it's a really
primitive text editor, is that it will take redirected input from a text
file script like that.
Now if you want the script file to cause |nEDLIN|n to insert any lines, you
have to remember that |nEDLIN|n requires a
sert mode back to the command mode. So the
script file. It's not easy to get a
done. With |nEDLIN|n itself. You use the
LIN to tell |nEDLIN|n that the next keystroke you enter should be interpret-
ed as a control character. So
That script, if redirected as input into an EDLIN command, would insert
the command |nECHO|n OFF before the first line of the file you're EDLINing.
(Remember that ^C or ^V means the same thing as
The next time you look at or edit that script file, the V will be miss-
ing, but that's ok. It was only there in order to tell |nEDLIN|n to put the
^C into the file, and it served its purpose. You can't just type
ches from insert mode to command mode. |nEDLIN|n can't tell you were trying
to put the ^C into the text rather than trying to switch to command mode.
So that's why you needed the
Don't forget that if you have DOS version 5 and have /P as part of your
DIRCMD environment variable, then if you should use the command:
|nDIR|n > FILE1
to put your directory listing into a text file, DOS will be performing
the command |nDIR|n /P because of your DIRCMD setting, and it will be sit-
ting there waiting for you to "Press any key . . ." only you won't real-
ize it because the "Press any key . . ." message has been redirected into
the FILE1 file along with the rest of STDOUT, and you'll think you've
locked up the computer when all you need to do is press any key. Then
redo that command like this:
|nDIR|n /-P > FILE1
to make DOS ignore the /P in the DIRCMD variable this time.
You can't redirect the input or output of a batch file, although you can
use |nredirection|n on each line in a |nbatch file|n. For example, to make all
output of a |nbatch file|n go to the NUL device instead of to your screen,
you might be tempted to try this:
BATCH > |nNUL|n
Nope, it won't work! BATCH.BAT will be executed as usual, and all the
STDOUT will go to the screen. If you want to suppress the output of the
|nbatch file|n, you need to put a > |nNUL|n at the end of each line in the batch
file. |nRedirection|n on the command line that executes the |nbatch file|n won't
work, even though |nredirection|n will work just fine inside the |nbatch file|n.
All DOS commands send their output to either STDOUT or STDERR. STDERR is
always the monitor, and STDOUT is the monitor unless |nredirection|n has been
specified. But lots of programs that don't come with DOS send their out-
put straight to video memory, and for those programs, trying to redirect
output from the screen to somewhere else just won't work! And lots of
programs take their input straight from the keyboard rather than from
STDIN, so for those programs, input |nredirection|n won't work. Sorry!
And remember that when you're using piping, the command to the right of
the pipe symbol is still a plain old regular DOS command, so just like
always, its executable file must be either in the current directory, or
on the PATH, in order for the command to work.
The |TSUBST|T Command
This is a command that's kind of dangerous (although it's certainly safer
than |sASSIGN|s), but it does have its uses if you follow the rules.
It is used to make a directory pretend like it is a drive. For example:
|nSUBST|n G: C:\WORD\DOCS\LTRS\JOHN
After you enter that command you can reference the C:\WORD\DOCS\LTRS\JOHN
|ndirectory|n by simply typing G:.
Of course for that command to work you have to use the LASTDRIVE command
in your CONFIG.SYS file to tell DOS you'll be needing a G: drive. If the
highest drive letter you already have is D:, then you want to say some-
thing like |nSUBST|n E: C:\WORD\DOCS\LTRS\JOHN instead of using G:, and then
you'll only need to say LASTDRIVE=E, instead of G, in |nCONFIG.SYS|n.
To cancel a SUBSTitution and put things back to normal, |nSUBST|n G: /D or
|nSUBST|n E: /D will do it. To display a list of SUBSTitutions you have in
effect, type |nSUBST|n all by itself, with no parameters.
There are a bunch of commands that are unsafe for use with any |nSUBST|n in
effect: ASSIGN, BACKUP, CHKDSK, DEL, DISKCOMP, DISKCOPY, ERASE, FDISK,
FORMAT, LABEL, JOIN, MIRROR, RECOVER, RESTORE, and SYS.
So why would anybody want to use a command that gives problems with so
many other DOS commands? Well there are quite a few times when this is
useful. For one thing, if you find that your PATH environment variable
is too long, and you don't have time right now to reorganize your entire
hard drive or write |sbatch file|ss so you can shorten it, you can do |nSUBST|n
E: C:\WORD and |nSUBST|n F: C:\UTIL and replace C:\WORD with E:\ and C:\UTIL
with F:\ on your |nPATH|n command in your AUTOEXEC.BAT file, and that saves
you 8 characters. But that is not a permanent solution to the 127-char-
acter limit for the |nPATH|n variable! Use batch files or DOSKEY |nmacros|n in-
stead of a long |nPATH|n.
What if you have an application such as an old version of WordStar, that
doesn't know anything about pathnames and stuff? You can trick WordStar
into using subdirectories by saying |nSUBST|n E: C:\WORD\DOCS and then tell-
ing WordStar to pull up a file from your E: drive.
And then there's always the reason of just plain laziness. It's a lot
easier to type E: than it is to type C:\WORD\DOCS\LTRS\JOHN. But in my
opinion that is nowhere near a good enough reason to use such a danger-
You can also do something like this:
|nSUBST|n A: C:\TEMP
for programs that insist on using drive A: when you want them to use your
hard drive. After you issue that command, whenever the program requests
something from drive A:, DOS will give it something from the TEMP direc-
tory of drive C: instead.
Or for programs that want drive A:, and you made the mistake of buying
the program on the wrong size disks, and you can only use them in your
B: drive, and the program won't work because it wants drive A:, and oh
my, what are you going to do? Try |nSUBST|n A: B:\ and see if it works.
Of course you can't use your A: drive while one of these commands is in
effect, because whenever you tell DOS something about A:, it will think
you're talking about C:\TEMP or B:\ or whatever is SUBSTituted for A:.
Now if you have some application that requires you to use the |nSUBST|n com-
mand because that app doesn't understand about subdirectories, then you
want to only run that app from a batch file that makes the SUBSTitution,
runs the program, and then cancels the SUBSTitution between the time you
exit the app and the time you get your DOS prompt back. That way, you
don't have to worry about those commands that |nSUBST|n is not compatible
Well, you know what the |nkeyboard|n is, so why am I writing a chapter about
it? Well there are quite a few things you might not know about it, even
though all its keys are labeled.
First, the most important thing that's not written on the |nkeyboard|n, is
that you can BREAK out of many programs by holding down the
while pressing the
If you're not pressing
or if you are pressing
stroke combination can be abbreviated as
if you want to get out of nearly any DOS command, and many other com-
mands too, this keystroke will usually take you straight back to a DOS
prompt. There is a difference between
If you've already entered some keystrokes that haven't been processed
yet, that is, if you're typing faster than the computer is computing,
the unprocessed keystrokes are still sitting in the |nkeyboard|n buffer.
just like any other keystroke, waiting for its turn to be processed.
will work sometimes when
If your computer is spitting out a bunch of data onto the screen a lot
faster than you can read it, you can stop it with the
have one, or else the
the screen start going again. (Sometimes you have to use
make it start going again after using
End-of-File character. (The caret (^) symbol means
using the COPY CON command, or the SORT command without any redirection
of input, then ^Z is what tells DOS you're done entering data from the
|nkeyboard|n as far as that specific |nCOPY|n |nCON|n or |nSORT|n operation is concerned.
and move the cursor down one line so that you can start over on the com-
mand you were getting ready to enter.
In a lot of programs, you can enter ASCII symbols that aren't on the key-
board, by holding down the
numeric keypad, and then letting up on the
you use this method to type
interesting use for this fact is with |nASCII|n character 255. It's called a
blank. It looks like a
and it's even valid in filenames. So you can use it as a primitive sort
of security. You never want to use it in the middle of a filename, be-
cause everybody knows that a
so anyone who sees a filename like MY STUFF.TXT is going to realize right
away that it's an
displays filenames in DIR listings in two columns, with spaces between, a
filename like MYSTUFF
one who's not really familiar with the
filename is anything other than MYSTUFF.TXT. Well there's still another
problem with this. If you have DOS 5 and a body used the /B or /W swit-
ches with the DIR command, that filename will look like "MYSTUFF .TXT"
and once again, anyone who knows about
away. The same thing would happen with the output of the CHKDSK command
with the /V switch. But, if you don't give the filename an extension,
ectory listing. This is good for directory names, too. You could name
a |ndirectory|n PCT
in a row like that. Well this method of protection is good if all the
other people who use your computer are really beginners, who don't know
to type the
you want to access it. You even have to include the
name, on your PATH command in AUTOEXEC.BAT if you want that |ndirectory|n to
be on the |npath|n.
If you have a numeric keypad, then you have a
it is off, the arrows and other functions on the numeric keypad will be
activated. Most newer computers will boot up with the
automatically, but there are tons of little public domain utilities that
you can use as commands in your AUTOEXEC.BAT file, to turn it back off
again. The same goes for the
up with it on.
it works this way: with the key set one way, when you use the arrow keys
to scroll through a file, the cursor will stay right on the same place on
the screen, changing lines as the lines go by. With the
set the other way, when you scroll through the file, the cursor will move
on the screen, staying on the same line of text, or until that line gets
to the edge of the screen, anyway.
will cause the computer to send a copy of whatever's on your screen to
the PRN device. If the |nPRN|n device is not connected, is not turned on, or
is not online, your whole system could just hang until the printer times
out. If trying to print a graphics screen causes your printer to flip
out, then try the GRAPHICS command first.
to what software program you're running at the moment, but when you're in
DOS, they have their own functions. (See editing keys.) You can also
program them to do whatever you want them to do, with ANSI.SYS. (See al-
ware programs are concerned.
that key instead of a word. It's the one over on the right of the alpha-
bet keys, between the Right
nearly the most important key you have. It's what tells DOS you're done
typing a command, and that you want DOS to execute that command now.
ter to start printing everything that appears on your screen. To make it
stop doing that, press
A lot of books will tell you to find a key that looks like ³ in order to
perform an operation called piping, which is a form of redirection. Well
the key you're looking for looks like || instead of ³, but the books just
can't print a || character I guess. The || character is the
sion of the backslash (\), and its location depends on the |nkeyboard|n you
use. It's one of those keys that move around from brand to brand of key-
board. Most keys are in the same place no matter what kind of |nkeyboard|n,
but not that one. On the three keyboards I've used extensively, that key
has been located in three different places. Once near the
once below the
You don't have to know this stuff if you don't want to. Well it is pret-
ty important but not learning it is not going to make your computer use-
less or anything.
The |tdecimal|t numbering system is the one you've been using all your life.
It uses ten (10) as its base number. (There are ten symbols in our num-
bering system: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.) That means that in a
multi-digit number, the rightmost digit tells how many multiples of 10-
to-the-0th-power are in the number. (N^0=1) The first digit from the
right tells how many multiples of 10-to-the-1st-power are in the number.
(N^1=N) The second digit from the right tells how many multiples of 10-
to-the-2nd-power are in the number. (N^2=NxN) The third digit from the
right tells how many multiples of 10-to-the-3rd-power are in the number.
(N^3=NxNxN) Et cetera. (In math, the symbol ^N means to-the-Nth-power.)
All right, suppose we have a number in the |ndecimal|n system that looks like
589,236. Well, what does that number mean?
Decimal, Binary, Hexadecimal continued
5 4 3 2 1 0---how many digits from right
5 8 9 2 3 6---the digits in the number
Now, add up the totals from each line, and you've got 589,236. That's
right, that's just the number we started with. That's because we just
converted a |ndecimal|n number right back to a |ndecimal|n value.
But computers can't deal with the |ndecimal|n system. A computer can only
distinguish between two things. Either a particular circuit has |npower|n
running through it, or it doesn't. Either on or off. One or zero. So
computers use the |tbinary|t numbering system. |nBinary|n means two, so the bi-
nary system has only two different digits. Zero, and one. That's all
there is. There is no 2, no 3, no 4, nothing but 0 and 1. What kind of
Decimal, Binary, Hexadecimal continued
numbers can you make with only two possible symbols? Any numbers you can
make with ten symbols. It just takes more digits to do it.
So, suppose we have a |nbinary|n number like 10110101101. What does it mean?
10 9 8 7 6 5 4 3 2 1 0
1 0 1 1 0 1 0 1 1 0 1
Decimal, Binary, Hexadecimal continued
Now, add up the totals from each line, and you've got 1453. You've just
converted a number from |nbinary|n to |ndecimal|n! Aren't you proud?
Now we're going to convert that |ndecimal|n number back to |nbinary|n! Aren't
you excited about that prospect? Here goes. Well, we know that 1453 is
larger than 2^10. But is it larger than 2^11? Well 2^11=2048, so no,
our |nbinary|n number won't need an eleventh digit. (It will have eleven
digits, but the first one is the zeroth digit, so the eleventh one is
digit number ten. Clear as mud, right?) All right, we know that we're
going to need a 1 in the tenth digit, because our number is larger than
2^10 which is 1024. So, subtract 1024 from our number, and we have 429
left. Well, do we need a one in the ninth digit? 2^9=512, and 429 is
less than that, so no, we won't need a number in the ninth digit. Fill
it up with a zero. What about the eighth digit? 2^8=256, and 429 is
larger than that, so we need a one in the eighth digit. 429-256=173 so
that's the next number we're going to work with. Do we need a one in the
seventh digit? 2^7=128, and 173 is larger than that so we do need a one
in the seventh digit. 173-128=45. 2^6=64, so we don't need a one in the
Decimal, Binary, Hexadecimal continued
sixth digit. Fill that space with a zero. 2^5=32 and 45 is larger than
that, so we need a one in the fifth digit. 45-32=13 and 2^4=16, so the
fourth digit gets a zero. 2^3=8 and 13 is larger than that so the third
digit gets a one. 13-8=5 and 2^2=4 so the second digit gets a one. 5-4
=1 and 2^1=2 so the first digit from the right gets a zero, and 2^0 is 1
and 1 is what we had left, so the rightmost digit gets a 1. So, here's
what we've got: 10110101101 Yep, that's just what we started with!
Ok, now to the |thexadecimal|t system of numbering. Hex means six and deci-
mal means ten so |nhexadecimal|n means sixteen. That's the base number of
this system, just like ten is the base in the |ndecimal|n system and two is
the base in the |nbinary|n system. There are sixteen symbols in the hex sys-
tem: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. We use this
system with computers a lot because it's a lot closer to |nbinary|n than dec-
imal is, since sixteen is two to the fourth |npower|n and ten is not an even
|npower|n of two at all. But yet, hex is definitely closer to |ndecimal|n too,
since you don't have to use eleven digits just to represent the number
1453 like you do in |nbinary|n.
Decimal, Binary, Hexadecimal continued
So, if we have a hex number like 3FA8C, what does it mean?
4 3 2 1 0--how many digits from right
3 F A 8 C--the digits in the number
3 15 10 8 12--|ndecimal|n representation of hex symbol
All right, add up those totals from each line, and you've got 260748.
That's what 3FA8C hex is, in |ndecimal|n. Want to convert 260748 back to
hex? I knew you did. Ok, let's go.
Well 16^5=1048576 and 260748 is much less than that, so we will not need
a fifth digit at all. 16^4=65536 and 260748 is larger than that so we
will need a fourth digit, but what number should go in that digit? Div-
ide 260748 by 65536, and you see that we need a 3 in that digit. What's
left over after we subtract 3x65536 from 260748? 64140. Well, 16^3=4096
Decimal, Binary, Hexadecimal continued
and 64140 is way bigger than that, so we won't want a zero in the third
digit, but what do we want to put there? Divide 64140 by 4096, and we
get a 15 which is an F in hex. Now, subtract 15x4096 from 64140, and our
remainder is 2700. 16^2=256 and 2700 is lots bigger than that. Do your
division, and 10 |ndecimal|n or A hex goes in the second digit, with 140 left
over. 16^1=16 and 140 is bigger than that. Divide. The first digit is
8 with 12 left over, and 12 in hex is C so that's the zeroth digit. Put
it all together and you've got 3FA8C. Yep, that's what we had to begin
with, so the conversion worked perfectly. Whew!
If you don't understand how it is that we're doing this |ndecimal|n-to-what-
ever conversion stuff, maybe it would help if we tried using the same
method to convert a |ndecimal|n number to |ndecimal|n? Let's try it, with the
number 857203. Well 10^6=1000000 and 857203 isn't that big, so we won't
need any number in the sixth digit. 10^5=100000 and 857203 is bigger
than that so what number do we need in the fifth digit? Divide 857203
by 100000 and you get 8. So subtract 8x100000 from 857203 and you have
57203 left. 10^4=10000 and 57203 is larger than that, and if you divide
Decimal, Binary, Hexadecimal continued
57203 by 10000 you get a 5 for the fourth digit, and if you subtract 5x
10000 from 57203 you have 7203 left. Well 10^3=1000 and 7203 is larger
than that, so if you divide 7203 by 1000 you get 7 so that's the third
digit, and if you subtract 7x1000 from 7203 you get 203. Well 10^2=100
and if you divide 203 by 100 you get a 2 for the second digit, with 3
left over. 10^1=10 and 3 is not that big so a zero goes in the first
digit from the leftmost one. 10^0=1 and 3 is 3 times that, so a 3 goes
in the zeroth digit. Put them all together, and you've got 857203.
Ok, should we do the octal system of numbers next? Well octal means 8
so the octal system has eight digits. 0, 1, 2, 3, 4, 5, 6, and 7. I'll
leave the rest of it up to you if you're interested. It works just the
same way as the other systems.
Just one more thing. If you ever need to convert an eight-digit |nbinary|n
number to hex, or convert a two-digit hex number to |nbinary|n, there's a
very easy way to do it. First, each digit in a |nbinary|n number is a bit.
Eight |nBInary|n digiTS (bits) is a byte. Four |nbinary|n digits, half a byte,
Decimal, Binary, Hexadecimal continued
is a nibble, believe it or not. Well if you have a |nbinary|n number like
10110011, first divide that into two nibbles. The leftmost nibble is
1011 and the rightmost nibble is 0011. Now, all you have to do to con-
vert that whole byte to hex, is to convert the left nibble to hex and
convert the right nibble to hex, and stick those two numbers together.
total=11 |ndecimal|n=B hex total=3 |ndecimal|n=3 hex
So, 10110011 in |nbinary|n equals B3 in |nhexadecimal|n. To convert a two-digit
hex number to |nbinary|n, just do the opposite. Convert the left digit to
|ndecimal|n and then |nbinary|n, and convert the right digit to |ndecimal|n and then
|nbinary|n and stick the righthand |nbinary|n number up against the right of the
lefthand |nbinary|n number, and there you go.
So, did you notice anything familiar in that section on |nbinary|n numbers?
Decimal, Binary, Hexadecimal continued
Did the numbers 64, 128, 256, 512, or especially 1024 ring a bell? Have
you ever wondered why a kilobyte is equal to such a silly number as 1024
bytes, instead of 1000 |nbytes|n? That's because computers do things in bi-
nary, not |ndecimal|n. The number 1000 in |ndecimal|n, is 1111101000 in |nbinary|n.
We don't want to make the computer try to work with a number like that,
do we? While two to the tenth |npower|n is 1024 in |ndecimal|n, in |nbinary|n it's
10000000000 and that's a nice easy round number for the computer.
Those other numbers I mentioned are going to end up being very familiar
to you as well if you pay any attention at all to what your computer does
with memory and disk space and stuff. 512 is 2^9, 256 is 2^8, 128 is
2^7, and 64 is 2^6 and they are very common numbers when talking about
|nmemory|n. As far as the computer is concerned, they are the round numbers
1000000000, 100000000, 10000000, and 1000000 and it's only because they
have been translated into |ndecimal|n that they seem to be random values.
When you see something like 10h or 10H that means the number 10 in hex-
adecimal, which is 16 in |ndecimal|n. Some books will even say 10d or 10D,
to avoid ambiguity even when they're talking about |ndecimal|n numbers.
What Are |tLogical Drives|t?
Well, a logical drive is one that doesn't really exist physically, but
that DOS thinks exists. For example, a RAMdisk. That's just a chunk of
memory that DOS has been told to treat like a disk. It has a drive let-
ter, like D: or E:, and you can copy files to it, or read files from it,
but you can't open up the computer's case and put your hand on it. Be-
cause it's a section of |nmemory|n. So it's not a physical drive, but it is
a logical drive because DOS treats it like a drive.
If you have a very large hard drive and you have it partitioned into more
than one section (that was probably done with |sFDISK|s), each with its own
drive letter, DOS treats those partitions as if they were totally separ-
ate drives, even though they're all right there on the one physical hard
drive. Those are |nlogical drives|n too.
If you have used the SUBST command to tell DOS that you are going to pre-
tend that your C:\WORD\DOCS directory is really drive F:, then that's a
logical drive too. You can't open up your computer's case and find any
Logical Drives continued
drive F: that's separate from any of your other physical drives, and yet
DOS will let you refer to the files in C:\WORD\DOCS by just using the
What if you have a computer with only one floppy drive, drive A:? How
could you possibly copy files from one |nfloppy|n disk to another? If you
tried the command |nCOPY|n A:FILENAME.EXT A:, hoping that DOS would tell you
to put a different disk in the drive to accept the copy, well sorry, but
that's not going to happen. DOS is going to say "File cannot be copied
onto itself". What can you do? Easy. |nCOPY|n A:FILENAME.EXT B: will do
it. But you don't have a drive B:, you say? Sure you do. Not a phys-
ical one, but a logical one. Whenever you only have one |nfloppy|n drive DOS
automatically gives you a logical drive B: which is sort of a ghost twin
to drive A:. So you can do lots of operations that require two drives,
and DOS will just tell you at the appropriate moment, whether to put in
the disk for drive A: or the one for drive B:. You put them in the exact
same place, but DOS keeps track of which is which.
Logical Drives continued
Well if you do have a physical drive B:, you can still convince DOS to
give you |nlogical drives|n to go with your floppy drives like that. With a
device driver called |TDRIVER.SYS|T. You load this contraption into your
CONFIG.SYS file with a DEVIC|1E command, and DOS will set up the logical
drives, and assign the drive letters according to whatever drives you
already have. Suppose you have a hard drive partitioned into logical
drives C: and D:, and you have a RAMdisk E:, and you put the |nDRIVER.SYS|n
in after the line that loads the |nRAMdisk|n, then the first logical drive
you set up with |nDRIVER.SYS|n will be F:, the next one will be G:, etc.
Don't ever forget, DOS assigns logical drive letters to |nlogical drives|n on
a first come, first served basis. Every time you boot up, DOS looks to
see how many hard drive partitions you have, and gives them each a letter
starting with C:. Supposing your hard drive has only one partition, then
D: is the next letter available by the time DOS executes the commands in
the |nCONFIG.SYS|n file, so the first |nDEVICE|n command in |nCONFIG.SYS|n that tries
to set up a logical drive, will get the letter D:. Then the next request
for a logical drive from |nCONFIG.SYS|n will get letter E: and so forth until
Logical Drives continued
CONFIG.SYS is finished. You can't control the order in which DOS assigns
drive letters to physical drives, because it will always be in alphabet-
ical order, but by changing the order of the statements in |nCONFIG.SYS|n you
can control which |nlogical drives|n will get what drive letters.
Now if you were already using some SUBST commands in your AUTOEXEC.BAT
file perhaps, for drive letters F: and G:, you'll have to change them to
H: and I: if you create |nlogical drives|n in the |nCONFIG.SYS|n file that re-
ceive drive letters F: and G:. Because the letters F: and G: are now
going to refer to your floppy drives, so you don't want to use them for
|nSUBST|n commands. Also, any batch file that is going to reference those
SUBSTituted drives, you have to change those references to H: and I: as
well. Setting up |nlogical drives|n with DRIVER.SYS can affect any logical
drives that you had set up with RAMdisks or |nSUBST|n commands, so watch what
your batch files say! If you add or remove any |nlogical drives|n, that will
change the drive letters that your other |nlogical drives|n are going to re-
ceive, but your batch files are still referring to the same drive letters
as before, which now are assigned to different |nlogical drives|n, and that's
Logical Drives continued
going to be a real mess unless you update each batch file with the new
drive letter assignments.
If you use your RAMdisk all the time, and plan to keep DRIVER.SYS in your
CONFIG.SYS file only sometimes then put the |nDRIVER.SYS|n line or lines af-
ter the |nRAMdisk|n line. That way, whether you're using the |nDRIVER.SYS|n or
not, your |nRAMdisk|n keeps its same drive letter all the time. If you put
the |nDRIVER.SYS|n before the |nRAMdisk|n, then your |nRAMdisk|n's drive letter would
be always changing depending on whether you have the |nDRIVER.SYS|n installed
today or not. If you plan to use |nDRIVER.SYS|n all the time and |nRAMdisk|n on-
ly sometimes, then do it the other way around. Put the |nRAMdisk|n after the
|nDRIVER.SYS|n, so your "ghost twin" floppies always keep their same drive
letters, whether or not you are using a |nRAMdisk|n today. If you do change
the order of the logical-drive-creating commands in |nCONFIG.SYS|n, you have
to remember to change every |nbatch file|n you have that references a logical
Even more important, whether you're using SUBST or not, or using a |nRAM|n-
Logical Drives continued
disk or not, any time you create |nlogical drives|n in any way, DOS needs to
be warned that you are going to be using them. If you're ever going to
end up with a drive F: or a drive J:, you have to have a LASTDRIVE com-
mand in your CONFIG.SYS file to tell DOS how many |nlogical drives|n you're
going to be using.
Now suppose you do have those drives set up the way I mentioned, so that
when DOS gets to the DRIVER.SYS line in |nCONFIG.SYS|n the letters F: and G:
are the next available ones, DOS will assign F: to the first |nDRIVER.SYS|n
statement you have, and if you have another one too, it will get G:, and
the next one will get H:, and so forth. If the first one was set up to
match your A: drive then you can do something like |nCOPY|n A:FILENAME.EXT F:
just like a person without a B: drive can do |nCOPY|n A:FILENAME.EXT B:. DOS
will tell you when to take out the A: disk and put the F: disk into the
same physical drive. Now you can copy files from one 3.5" disk to anoth-
er even if you only have one physical disk drive of that size. Before
|nDRIVER.SYS|n, you could only do that with the DISKCOPY command.
Logical Drives continued
Know what else you can do with DRIVER.SYS? If your physical drive A: is,
for example, a high density 5.25" drive, you can set up a logical ghost
twin for it that is a double density 5.25" drive, and then you can say
|nFORMAT|n F: instead of remembering to say |nFORMAT|n A: /F:360 and the disk'll
get formatted to double density even though it's physically being done in
a high density drive. If you tell DOS that F: is a 360K drive, then DOS
will use the 360K FORMAT when you specify drive F:. (Of course that will
not work the other way around. If you have a double density drive, you
can't make DOS pretend that it's a high density drive. A double density
drive just doesn't have the right hardware to read or write high density
disks, no way, no how.)
If you did that, making a double density logical drive twin for your high
density physical drive, you can still use high density |ndisks|n in that dou-
ble density logical drive! It's only double density for formatting pur-
poses. It's still physically a high density drive, so it can still read
and write high density |ndisks|n.
Logical Drives continued
If you wanted to, you could even give the exact same DEVICE=DRIVER.|nSYS|n
command twice in a row, making two extra |nlogical drives|n for one physical
drive. That could be useful for if you have a third floppy drive, which
needs a DRIVER.SYS driver to even work, and then the second |nDRIVER.SYS|n
line, for that drive, would set up a logical drive twin for it, so that
you could copy between disks in that drive.
All right, how do you use |nDRIVER.SYS|n? Well it's not too hard. Here's
DEVICE=D:\DIR\DRIVER.|nSYS|n /D:# /T:## /S:## /F:#
where D: is the drive where the |nDRIVER.SYS|n file is located, \DIR\ is the
directory where that file is located, and here are the switches:
/D:### is the physical drive number that you want the logical drive to be
a ghost twin to. 0 is for drive A:, 1 is for B:, 2 is for the next flop-
py drive, etc.
/T:## is the number of tracks, on each side of the logical drive you're
Logical Drives continued
setting up. For a 360K disk, that would be 40, and for a 720K, 1.2M,
or 1.44M disk, that would be 80. The default already is 80, so unless
you're setting up a 360K logical drive, you can omit the /T:80 part.
/S:## is the number of sectors on each track of the logical drive you're
setting up. For a 360K or 720K disk, that would be 9. For a 1.2M disk,
15, for a 1.44M disk, 18, or for a 2.88M disk, 36. The |ndefault|n is 9, so
if you're setting up a double density logical drive, you can omit this
/F:# tells DOS what type of physical drive you're setting up the logical
drive in. Here are the choices: 0 for 360K, 1 for 1.2M, 2 for 720K, 7
for 1.44M, and 9 for 2.88M. The |ndefault|n is 2 so if you're setting up a
logical drive in a 720K disk drive, you can leave out the /F:# switch.
So here's the command you would use to make a 720K logical drive twin
for your 3.5" 1.44M A: drive:
DEVICE=C:\DOS\DRIVER.|nSYS|n /D:0 /F:7
Logical Drives continued
For a 360K logical drive twin for your 5.25" 1.2M B: drive:
DEVICE=C:\DOS\DRIVER.|nSYS|n /D:1 /T:40 /F:1
For a 1.2M logical drive twin for your 5.25" 1.2M B: drive:
DEVICE=C:\DOS\DRIVER.|nSYS|n /D:1 /S:15 /F:1
Or for a 1.44M logical drive twin for your 3.5" 1.44M A: drive:
DEVICE=C:\DOS\DRIVER.|nSYS|n /D:0 /S:18 /F:7
Of course all those examples assume that your DRIVER.SYS file is located
in the \DOS directory of your C: drive.
If this doesn't seem to work properly, try using the /F:# parameter for
the logical drive you're trying to set up, rather than using the one for
the physical drive you're trying to set it up in. But be warned that it
is not a good idea to lie to the |nDRIVER.SYS|n |sdevice driver|s!
The |tCONFIG.SYS|t File
This is an ASCII text file that contains some special configuration com-
mands, which DOS reads each time you reboot your computer as long as the
file is located in the root directory of the disk you're booting from.
You can make any changes you want to this file but they won't take effect
until the next time you |nreboot|n. Have a spare boo|1t disk handy first just
in case something doesn't work right, though. Here are the commands that
can be used in the |nCONFIG.SYS|n file:
BREAK COUNTRY DEVICEHIGH DRIVPARM FILES LASTDRIVE SHELL SWITCHAR
BUFFERS DEVIC|1E DO|1S FCBS INSTALL REM STACKS SWITCHES
|nBREAK|n and |nREM|n can also be used as regular DOS commands, but the others
can't be used anywhere except in the |nCONFIG.SYS|n file, and no other com-
mands besides these can be used in this file. Any number of |nDRIVPARM|n,
|nINSTALL|n, |nREM|n, or DEVICE (or DEVICEHIGH) commands can be used, but the
others can only be used once in the file. The DEVICE command is used
to activate device drivers. RAMDRIVE.SYS, DRIVER.SYS, SMARTDRV.SYS,
and ANSI.SYS are a few examples of device drivers that come with DOS.
Each device driver can also be loaded only once, except |nDRIVER.SYS|n and
the RAMdisk drivers, which can be repeated.
The |TSWITCHES|T Command
This command was introduced with version 4 of DOS, and it can be used in
the CONFIG.SYS file to make DOS treat an extended 101-key keyboard like a
conventional 84-key |nkeyboard|n. If you're running a program that doesn't
like your extended |nkeyboard|n, try the command SWITCHES=/K in your CONFIG
.|nSYS|n file and reboot. Now DOS will totally ignore the scan codes passed
by those extra keys, and use the scan codes for their matching regular
keys instead, so they can't confuse your application or cause your system
to crash anymore. What I mean by that is if you hit the <*> key over on
the numeric keypad, DOS will ignore that scan code and use the code for
the <*> key over on the regular part of the |nkeyboard|n. If you use this
command and also install the ANSI.SYS device driver, use the /K switch
with ANSI also, as in:
The |TTYPE|T Command
This command is pretty much straightforward. It just types a disk file
to the screen where you can look at it. Or you can use it with output
redirection to send a copy of the file to your printer, or to a different
If the file is so long that it won't all fit on the screen at once, you
can stop the display from scrolling with the
ation, or the
ter with |nredirection|n, or you can just use the |nMORE|n command instead of the
|nTYPE|n command if you're really careful about using the < symbol instead of
the > symbol!
One big problem with the |nTYPE|n command is that if you use it on a file
that has a ^Z (End-of-File) character inside it, |nTYPE|n will think that's
the end of the file, and won't display another byte of it. So if you
think that the file concatenation you just tried didn't work, it could be
that it worked just fine, only one of the first files in the concatena-
tion had a ^Z at the end of it, so the |nTYPE|n command won't display the
other files that you concatenated onto the end of that one. They're
there, but you just can't see them with the |nTYPE|n command. You can see
them, though, with the command |nCOPY|n /B FILENAME.EXT |nCON|n because the COPY
command with the /B switch will look in the file's directory entry and
see how many bytes long the file is, and copy all those |nbytes|n without
paying any attention to whether there are any ^Z characters in there.
Most .COM and .EXE files have ^Z (End-of-File) characters and ^G (Bell)
characters in them, so if you use the |nTYPE|n command on one of these, you
will hear a beep each time you reach a ^G character, and then the first
time you reach a ^Z character, the |nTYPE|n command will just stop and give
you back your DOS prompt.
Another use for the |nTYPE|n command is if you have a batch file where you'd
like to display a bunch of lines of messages to the screen all at once
from within that |nbatch file|n. You could use a whole bunch of ECHO com-
mands, but that would be really slow since DOS reads each line of a batch
file from the disk, executes that command, reads the next line, etc. A
faster way would be to make an ASCII file that contains just those mess-
ages that you want displayed, and perhaps name that file MESSAGES.TXT and
put it in your BELFRY directory (because that's where .BATs belong) and
then instead of putting all those ECHO commands into the batch file, just
put the command |nTYPE|n C:\BELFRY\MESSAGES.TXT in there instead. But then
if you give a copy of that |nbatch file|n to a friend, don't forget to give
him the MESSAGES.TXT file too.
Anyway, the syntax for this command is just about as simple as it could
be, just the word |nTYPE|n followed by the filename and extension of the file
you want to display on your screen. And of course if the file is not in
the current |ndirectory|n of the |ncurrent|n drive, then you tell DOS where it is
by including the entire |spath|sname for the file. Some examples:
The worst thing about the |nTYPE|n command is that it only goes one way. I
mean if you want to go back and look at an earlier part of the file that
has already scrolled off the screen, you have to BREAK out of the command
the same |nTYPE|n command again, and start over from the beginning. There
are lots of little public domain utilities such as BROWSE.COM, that you
can download from your local BBS, that let you use the
The |TSWITCHAR|T Command
This command only existed in DOS versions 2.0 and 2.1, and it could be
used in the CONFIG.SYS file to tell DOS what character you want to use
for switch parameters. For example, if you used the UNIX operating sys-
tem a lot, that system uses a - for a switch character. Then when you
use DOS you would have to get used to using / instead. Well if you put
the command SWITCHAR=- into your |nCONFIG.SYS|n file, then you could say |nDIR|n
-P instead of |nDIR|n /P and it would be more like the UNIX system you were
used to. If you don't have DOS version 2, then you can't use this com-
mand. And if you aren't used to some other operating system besides DOS,
then you have no need for this command!
The |TPRINT|T Command
This command is used to send a copy of a file to your printer. It's the
very oldest example of a multitasker under DOS, because it works in the
background to keep on printing your file, even after it has given you
back your DOS prompt and you have begun working on something else!
This is not the complete syntax of this command, but it's about the only
important parts. Hardly anybody ever uses the other parts so I'm not
going to confuse you with them:
|nPRINT|n /D:PORT /Q:## /C /T D:\DIR\FILENAME.EXT
The first time you use this command after the last time you |sreboot|sed, it
loads itself into memory as a TSR. It also wants to know what port you
intend for it to print to. It will ask you, and it will fill in the
blank with PRN. If |nPRN|n is the port you want to use, then you just hit
then you include the /D:PORT switch right on the command line with the
|nPRINT|n command, as in |nPRINT|n /D:LPT1 or |nPRINT|n /D:|nCOM2|n, or wherever your
printer is attached. Now that's the port that the |nPRINT|n command is going
to use from then on, until you reboot the computer. You can't use the
/D:PORT switch again to change it to something else. If you want to
change it, you have to |nreboot|n and start the |nPRINT|n TSR over again.
Now the |nPRINT|n |nTSR|n is installed into memory, and the print queue is empty.
(The print queue is the internal list where the |nPRINT|n command stores the
names of the files that you've told it to print, that haven't been print-
ed yet.) Or if you did put the filename on the command line when you
loaded the |nTSR|n into |nmemory|n, then that file goes right into the queue and
starts printing. Now if you think of another file you'd like to print,
you just give another |nPRINT|n command with that second filename on the com-
mand line, and that file will be added to the queue (that's pronounced
just like the letter Q, by the way), and when the first file is done
printing, |nPRINT|n will look at the queue and print any files that are there
waiting to be printed. The queue can hold up to ten filenames at a time.
If you need to be able to queue up more files than that at a time, you
can use the /Q:## switch on the command line, but only the first time you
issue the command. If you've already loaded the |nPRINT|n TSR into memory,
then you have to reboot before you can issue a command like |nPRINT|n /Q:20
to enlarge the queue. Any number up to 32 is allowed there.
If your printer dies or if the paper gets all jammed up, you can just say
|nPRINT|n /T and that terminates the printing and removes all the files from
the queue. (However, it doesn't remove the |nPRINT|n |nTSR|n from |nmemory|n.) Now
you can fix the printer or the paper, and start over. Remember that your
printer contains a small buffer of |nmemory|n where it stores data that it's
about to print. When you use |nPRINT|n /T to terminate printing, the printer
won't stop until it prints what's already in its own buffer, even though
|nPRINT|n immediately stops sending new data to the printer.
If you just decide there's one file that you had already put into the
print queue, that you don't want to print after all, you can remove it
from the print queue with the command |nPRINT|n /C D:\DIR\FILENAME.EXT which
will cancel that file from the queue.
You can also use wildcards with this command. That means you could put
all the files that start with PB and have the extension .TXT into the
queue with just one |nPRINT|n PB*.TXT command. The names of the files that
match that wildcard specification will be displayed on the screen, and if
you realize that you didn't mean to include a couple of those, you can
remove those from the queue with the /C switch.
And you can put more than one file into the queue at a time by typing
each filename on the command line, for example just one command: |nPRINT|n
C:\DOS\README.TXT C:\DOS\APPNOTES.TXT would print those two files.
If you have DOS version 2, then you can't print files from any but the
current directory of any drive. If you want to print a file from some
other |ndirectory|n, you have to use the CHDIR command to make that |ndirectory|n
|ncurrent|n, and then you can use the |nPRINT|n command to add that file to the
If you want to see what files are left in the queue at any time, just
issue the |nPRINT|n command with no parameters.
If you've ever heard the term "print spooler" and wondered what it meant,
the |nPRINT|n command is just a primitive example of a print spooler. It
means a little TSR utility that keeps sending data to the printer while
you go ahead and use the computer for something else.
Just like the TYPE command, |nPRINT|n will ignore any data in a file that
occurs after the first ^Z character.
The |TTREE|T Command
This command just shows you a sort of a list of all the directories and
subdirectories you have on your disk. Here's the syntax:
|nTREE|n D:\DIR /F /A
where D:\DIR is the drive and part of the directory tree where you want
to start the listing. Before version 4, you couldn't say the |ndirectory|n,
just the drive, for which you want the tree display. In version 4 if you
don't specify any pathname, it will start the display with the current
|ndirectory|n instead of the root the way older versions did. The /F switch
says you want to see the names of all the files under each |ndirectory|n.
And the /A switch, starting with version 4, lets you use a slightly diff-
erent character set for the display, in case your printer doesn't like
the normal one. That will make it use things like + and -- and || to draw
the lines with. Of course to get the display to your printer, you use
output redirection, as in:
|nTREE|n C:\ /F > |nPRN|n
The |TSETVER|T Command
This command is new to DOS version 5, and it is used to lie to programs
about what DOS version you are running. You see, many programs, as you
load them, the first thing they do is ask the operating system what ver-
sion it is. Well, programs that were written to accept an answer of any-
thing higher than X will run just fine under DOS 5. But some silly pro-
grammers told their program to accept an answer of version X through ver-
sion Y instead. And since a program like this was written before there
ever was a DOS version 5, it won't accept the answer of MS-DOS 5.00 at
all. The program is going to say "Incorrect DOS version", and refuse to
load into memory. Even if the program is perfectly compatible with ver-
sion 5, it won't run just because of a silly version number report. Well
Microsoft thought of a neat little way to get around this problem. First
call the publisher of the program that's giving you that "Incorrect DOS
version" error message, and ask them if the program is compatible with
DOS 5. If they say ok, then you can use the |nSETVER|n command to tell the
program that 5 is an ok number for it to run under. First you have to
have |nSETVER|n.EXE loaded into |nmemory|n as a device driver. To do that, if it
hasn't already been done, just put this line into your CONFIG.SYS file:
DEVICE=C:\DOS\SETVER.EXE (or |sDEVICEHIGH|s) and just like any other change
you make to the |nCONFIG.SYS|n file, you have to reboot to make it take ef-
fect. (And of course that sample command assumes that your |nSETVER.EXE|n
file is located in the DOS directory of your C: drive.) Now, you just
issue a command like this:
|nSETVER|n C:\DOS WP.EXE 3.3
That is assuming that your |nSETVER|n.EXE file is located in your C:\DOS dir-
ectory and that the name of the program that's giving you trouble is WP
.EXE and 3.3 is a DOS version under which that program used to run just
fine. Now after you give that command, |nSETVER|n is going to display a
warning message about how Microsoft is not responsible for anything bad
that could happen if you use this command. But you already called the
publisher of the WP.EXE program, right? And they told you it was ok to
do this, so don't worry about that message. Now, you just have to |nreboot|n
one more time to make this version number change thing take effect, and
from then on, whenever you try to load that program into memory, DOS will
lie to it and tell it that you're running DOS version 3.3, and the WP.EXE
program will be perfectly happy.
There are already some version-number lies automatically installed in the
|nSETVER|n.EXE program, the way it comes from Microsoft. To see what those
are, just type |nSETVER|n C:\DOS
grams, you can remove their entries from the |nSETVER|n table, using the /D
switch of the |nSETVER|n command, like this:
|nSETVER|n C:\DOS WP.EXE /D /QUIET
The /DELETE or /D switch tells DOS to remove that particular entry from
the |nSETVER|n version table, and the /QUIET switch tells DOS to suppress the
display of the message that it usually displays when removing an entry
from the table. Removing unneeded entries from the table will cause the
version table to take up a little bit less memory next time you reboot.
Later, if you want to change the version number that you told |nSETVER|n to
report to a particular program, just issue the same |nSETVER|n command again
with the different version number. It won't waste any |nmemory|n by using up
another entry in the table or anything. The new entry for that filename
will just replace the old one that's already in the table.
Now the |nSETVER|n command does make a permanent change to the version table
that it keeps inside itself. So you only have to give the command once,
not every time you reboot or anything. |nSETVER|n will keep on lying to that
program every time you execute the program, forever and ever, as long as
you keep the |nSETVER|n.EXE DEVIC|1E command line in your CONFIG.SYS file.
If you are not using any of the programs that already have pre-installed
lies in the version table, and you're not planning to get any of them,
and you have tried all your programs under the new DOS, and none of them
need the |nSETVER|n lies, then you don't need to leave the |nSETVER|n.EXE device
driver installed in your |nCONFIG.SYS|n file like the DOS 5.0 installation
program put it there. All it's doing is wasting memory if you don't run
any applications that need it.
The |TQBASIC|T Command
This is DOS version 5.0's new version of the old GWBASIC command. The
biggest difference is the look of the program, and that it has lots of
online help for you while you're running it. To get help, use the
To run a BASIC program straight from the command line, you type a command
|nQBASIC|n /RUN C:\DOS\PROGRAM.BAS
If the last instruction in the PROGRAM.BAS file is SYSTEM, then when the
program is done, it will return to DOS instead of just sitting there in
the |nQBASIC|n |nenvironment|n.
If you have some old BASIC programs written in GW-BASIC, the REMLINE.BAS
program that comes with DOS 5.0 will help you convert them to the format
that |nQBASIC|n uses.
Read the section on the |nGWBASIC|n command for more information.
The |TSORT|T Command
This command sorts ASCII files into |nASCII|n order. That's pretty close to
alphabetical order except that lowercase letters come after of all the
uppercase ones (...XYZabc...). But they corrected that problem starting
with DOS version 3, so now |nSORT|n really does sort in alphabetical order.
Actually, |nSORT|n is a filter, so it takes standard input and sends standard
output. If you just use |nSORT|n with no Input/Output redirection, your cur-
sor will just drop down a line and wait for you to enter some lines of
text for it to sort. You type the stuff and then hit
tell DOS you're done, hit
typed, by the first character in each line, and send the output to the
screen. If the first character is the same in two different lines, then
|nSORT|n will sort those two lines by their second character. If those two
characters are the same too, then the third character will be used as the
But you can use the |nSORT|n filter with input |nredirection|n, output redirec-
tion, piping, or any combination of those, to make it do just about any-
thing you want.
Here's the syntax for this command:
|nSORT|n /R /+# < D:\DIR\FILE1.EXT > D:\DIR\FILE2.EXT
where /R makes it sort in reverse order, /+# makes it sort by the # char-
acter instead of by the first character of each line, and FILE1.EXT is
the file you want it to sort. Just make sure that you use < and not >,
to make the file point toward the command. Because if you accidentally
use > instead, for that part of the command, then the file you wanted to
sort gets erased instead. Now if you want the output of the |nSORT|n command
to go, instead of to the screen, somewhere else like to the printer or to
a different file, then you use the > symbol with PRN for the printer, or
with a filename as in the example above. Make sure that you don't use
the same filename for the > symbol as you used for the < symbol, because
once again, that would erase the contents of that file before it gets a
chance to get sorted. And if you want to keep the FILE2 file instead of
the FILE1 file, then you can delete the FILE1 file after the command is
done, but first look at it to make sure that the |nSORT|n was successful and
didn't lose any of the data in the file. Then use the RENAME command to
give the target file the same name as what the source file had before you
deleted it. That is, if you want it to have the same old name.
You can also use |nSORT|n as the target of a piping operation. That means
you can sort the output of another command before displaying it on the
screen. For example, |nDIR|n || |nSORT|n /+14 would cause a DIR command to send
its output to the |nSORT|n command instead of to the screen, and |nSORT|n would
sort the directory listing by the data in the fourteenth column which is
the file size, and then that sorted output would go to your screen.
The trouble with that is that the lines of the |nDIR|n command's output that
say things like "Volume in drive C is WHATEVER" and "However many |nbytes|n
free" would be included in that sorted output. Yuk. To get rid of that
problem, use the FIND filter to get rid of those lines. Every line that
has to do with files and directories has a - character in it, in the date
column. So |nDIR|n || |nFIND|n "-" || |nSORT|n /+14 || |nMORE|n would take a |ndirectory|n
listing, remove the lines that don't contain -, sort the remaining lines
according to column 14, and display the output 23 lines at a time so you
can see it before it scrolls off the screen. Notice that it would work
just as well to say |nDIR|n || |nSORT|n /+14 || |nFIND|n "-" || |nMORE|n but it would take
longer, because there would be more lines for |nSORT|n to sort. Using the
FIND command first to filter out the lines you're not going to want any-
way, means there are fewer lines for |nSORT|n to deal with. Since |nSORT|n is
pretty slow, as far as computer programs go, you want to use |nFIND|n first
if that will serve the purpose, whenever you're using both filters in the
The first column in a directory listing is, of course, the filename. The
extension starts in column 10, the size in column 14, the date in column
24, and the time in column 34. Of course, if you have DOS version 5, you
don't need the |nSORT|n command to sort your DIR listings, but it's still a
useful command, for sure!
A few caveats: |nSORT|n can't handle files larger than 63 kilo|sbytes|s in size.
Each line in the file must have a carriage return (the
the end of it. If there is a ^Z End-of-File character at the end of the
file, it will be moved to the beginning since it has a lower ASCII code
number than any letters, and with a ^Z as the first character of the new
sorted file, you won't be able to TYPE the file to the screen, or PRINT
it, or do hardly anything with it! (That's one reason why I said to make
sure the |nSORT|n was successful before you delete the original file, if the
sorted one is the only one you plan to keep.) Make sure your file does
not have a ^Z in it before you use the |nSORT|n command on it. You can use
the COPY command with the /A and /B switches to remove a ^Z from a file.
For example, |nCOPY|n /A FILEB4 FILEAFTR /B, then |nRENAME|n FILEAFTR FILEB4 to
give it back its old name. Of course if FILEB4 has a ^Z in it before the
end of the file, all the data that came after it will be lost. Don't do
this unless the first ^Z in the file comes at the very end of the file.
Or else do it on a spare copy of the file first and check the results be-
fore you do it on the real copy.
What Is a |tTSR|t?
|nTSR|n stands for Terminate-and-Stay-Resident. Another name for |nTSR|n is Mem-
ory-Resident-Program. That means any program that you load into memory
once, and it stays there, at your beck and call, or just hanging around
in the background watching every move you make, until such time as you
reboot the computer.
DOS itself can be thought of as a |nTSR|n, except that TSRs are usually op-
tional, and DOS is not. If you don't have DOS resident in |nmemory|n then
your computer ain't going nowhere! Device drivers are also TSRs in a
way, but just a special type of |nTSR|n.
If you have a mouse or trackball, and you load its driver via AUTOEXEC-
.BAT rather than CONFIG.SYS, then it is not a device driver exactly but
it still is a |nTSR|n, most definitely. It hangs around in the background
watching you, and whenever you move your mouse it springs into action and
moves the mouse pointer around on your screen.
Automatic screen savers that blank your screen after a certain number of
minutes of keyboard inactivity are TSRs. Anything you can "hotkey" into
with a little keystroke combination like
|nTSR|n. There are lots of little phone book and appointment scheduler TSRs.
And here are some of the TSRs that come free with DOS: APPEND, DOSKEY,
DOSSHELL, FASTOPEN, GRAPHICS, MIRROR, MODE, PRINT, and SHARE. Except for
|nDOSSHELL|n and |nMIRROR|n, once you execute those commands, the |nTSR|n stays in
memory until you reboot. Some TSRs have commands that remove them from
|nmemory|n, but not most of the ones that come with DOS! Although there is a
great public domain utility called Mark-and-Release (and some others that
work in the same manner) that you can use to make it possible to remove
just about any |nTSR|n from |nmemory|n without rebooting.
Of course it's not possible to remove one |nTSR|n if there has been any other
|nTSR|n loaded into |nmemory|n after it. The only thing you can remove from mem-
ory is the most recent thing you put into |nmemory|n. Strangely enough, this
includes |sbatch file|ss. If you issue a command to remove a |nTSR|n from mem-
ory from within a batch file, that |nTSR|n won't drop out of memory until the
|nbatch file|n ends. Because although a |nbatch file|n isn't actually loaded in-
to |nmemory|n while it is executed, there is some batch-file-handling code,
that does take up a speck of |nmemory|n while the |nbatch file|n is running. So
the |nbatch file|n that gives the command to unload the |nTSR|n might cause the
|nTSR|n to be disabled and not work anymore, but the |nmemory|n that the |nTSR|n was
using won't be freed up for other uses until that |nbatch file|n exits to the
You mustn't ever try to load or unload a |nTSR|n from within another program,
such as when you're shelling out from your word processor or something.
You have to exit to the primary command processor before you can do any
messing around with |nmemory|n allocations, or you'll probably lock up the
whole computer and be forced to reboot, losing whatever data you had en-
tered into your application since the last time you saved it to disk.
If you have DOS version 4 or later, you can use the MEM command with the
/P or /D or /C switch to find out what TSRs you have loaded. Otherwise,
look and see what kinds of commands you have in your AUTOEXEC.BAT file.
The DOS commands you can look up right here to see if they're TSRs, and
the non-DOS commands you'll have to check the documentation that came
with that program. Now you know what TSRs get loaded from your AUTOEXEC
.BAT file, and then there could also be others that you've loaded since
your |nAUTOEXEC.BAT|n file was run at bootup.
There are lots of occasions when you need to absolutely and without a
doubt boot up without any TSRs whatsoever. For example, when you're in-
stalling a new software package you just bought, or every time you are
about to run a disk optimizer to take care of all your fragmented files.
The easiest way to do that, is to |nreboot|n from a boo|1t disk that was for-
matted with the /S switch, and that doesn't have any |nAUTOEXEC.BAT|n or CON-
FIG.|nSYS|n files on it. You can put those files on your |nboot|n disk, but only
if the CONFIG.SYS file doesn't contain anything except your hard disk's
device driver if your hard disk needs one, and only if the |nAUTOEXEC.BAT|n
file doesn't contain anything but PATH and PROMPT. Now you have a |nboot|n
disk that is safe to use whenever you're going to defragment your hard
drive or install some new software. This is necessary because really bad
things can happen if you have any TSRs in memory while you perform such
operations. Especially the disk optimizer. It's going to move all your
files to different parts of the disk. Well if there's anything in |nmemory|n
like a disk cache, or FASTOPEN, or anything that keeps track of where the
data is at on the disk, well, when the optimizer moves everything around,
then those TSRs are going to have the wrong info, and they are going to
trash your entire FAT. To really be on the safe side, reboot the compu-
ter again the very second the optimizer finishes! That will remove ev-
erything from |nmemory|n and let the TSRs read the changed information from
the disk again, in case you had forgotten to remove any of them.
TSRs work by trapping a certain interrupt. For example, a pop-up sched-
uler might sit there waiting for you to press the
if you have another |nTSR|n that grabs the interrupt for that keystroke also,
or if the application you're working on uses that keystroke, then you've
got a |nTSR|n conflict. There are a whole lot of ways that one |nTSR|n can con-
flict with another, or with a program. So whenever you start using a |nTSR|n
that you've never used before, watch out for problems, and if any occur,
it's probably the fault of your new |nTSR|n. There ain't no such thing as a
free lunch, ya know, so along with the convenience of pop-up schedulers
and other highly useful TSRs, you've got to expect some problems too.
Most TSRs work just fine all by themselves, but when you go using more
than one at a time, there could be trouble. I've been lucky, and only
had problems with two or three TSRs in my life, but I know people who've
had major problems with lots of them. It just depends on what sort of
system you have, what other TSRs you use, and what applications you run.
It also depends a lot on what order you have the different TSRs installed
in your AUTOEXEC.BAT file. If TSR-A doesn't work right when it's loaded
before TSR-B, then switch those |nAUTOEXEC.BAT|n lines around to load TSR-A
after TSR-B instead, and it might work just fine, believe it or not!
Many TSRs (and a lot of games too) take over the system clock (|sCLOCK$|s) a
bit more strongly than they ought to, and end up ruining the time and/or
date that DOS thinks it is. If you find that you have such a program,
you want to remember to reset the TIME every now and then, so that the
time in your directory listings stays close to correct. You can use a
batch file to help you remember to do that.
This looks like a good time to tell you the safe way to install a new
program, whether it be a |nTSR|n or not. First, never install more than one
new program in a day. Because if you do, and problems occur, you have no
idea which program went wrong. Install one, test it for a day or so,
then install the next one. And never install a program without a backup.
Before you install anything, reboot the computer with no TSRs loaded.
Using an |nINSTALL|n command with TSRs in memory can make the installation
program screw everything up. Read the program's documentation, especial-
ly the installation and troubleshooting chapters, and any README.TXT type
files that came with the program. README.TXT files are generally full of
information that the publishers didn't remember until after the manual
was printed, so you don't want to miss it! Now run the program's |nINSTALL|n
command and try out the new program. If it works ok, |nreboot|n your compu-
ter with your normal CONFIG.SYS and AUTOEXEC.BAT files, and test it some
more. If there are any problems, then "REM out" the device drivers and
TSRs from those startup files, and try again. Remove the REM from one
line at a time, reboot, test the program again, remove the |nREM|n from an-
other line, |nreboot|n, test, etc., until you discover which device driver or
|nTSR|n is conflicting with your new program. Try changing the order of the
command that loads that driver or |nTSR|n, try it again, etc. If your new
program just absolutely will not run with that |nTSR|n or driver, then you
have to make up your mind which one you'd rather give up.
Now besides installing new software, and using a disk optimizer, other
times when it's very important to remove all your TSRs and |ndevice drivers|n
from memory, are when you're about to use any BACKUP or RESTORE program,
or anything like PC Tools's DISKFIX command, or anything that's going to
seriously do low-level work on your hard drive. In DOS 5.0, the manual
even says that you must not use CHKDSK with its /F switch, with any TSRs
in |nmemory|n. And of course another reason to boot without TSRs is to free
up as much RAM as possible for program use, like if you've been getting
"Out of memory" errors. (See also LOADHIGH.)
|tCleaning|t Your Computer
Well, dusting the outside of the case is pretty obvious, but did you know
that you need to do the inside of the computer once in a while too? Yep,
the inside can get pretty nasty, because the fan in the |npower|n supply has
got to draw lots of air in from the front of the computer, across the
components, and out the back, to keep everything cool in there. You must
not ever do something like covering over the floppy drive openings, to
keep dirt out, because the computer desperately needs the air that goes
through there. Well, if air goes in, that's right, dust and cat hair and
stuff goes in too. Well when it starts to build up on the components, it
acts like insulation and keeps the air from cooling the components, and
you have a fried computer! So depending on how dirty the computer's en-
vironment is, about every three months you need to open up the case and
vacuum in there. Just be careful! See the section about Power for de-
tails about how to work inside the computer's case. And don't let the
vacuum attachment touch anything in there. Just get it close enough to
suck up the dirt. And while you've got the case open, go ahead and re-
seat all the cards and cables as described in that |nPower|n section.
Now for the monitor screen. Many monitors have a special coating that
protects them from damage. Well, glass cleaners can dissolve that coat-
ing. (I know, because I ruined mine that way.) If you've already used
some glass cleaner on it before you found that out, then you've probably
got a really blotchy screen from places where the coating is gone, and
places where it's still there. You may as well get that glass cleaner
back out and remove the rest of the coating. That would be better than
leaving it all blotchy like that. A tiny speck of liquid fabric softener
diluted with a bunch of water is a real good thing to clean your monitor
with, because that will help cut down on static electricity without dam-
aging that coating, if it's not already too late.
You should turn your keyboard upside-down and shake it, or even bump it
very gently against the desktop, every now and then to get rid of some of
the crumbs and dirt that are always getting in there. Use some alcohol
on a cotton swab or cotton ball to get the grime off the keys. If you've
got a key that's sticking real bad, pry off the cap and use some alcohol
on the inside of the cap. If you've got a |nkeyboard|n that's so filthy it
doesn't work at all anymore, and you intend to throw it away and buy a
new one, there's one last-ditch effort you can make to try and save it.
There are some keyboards that can handle being taken into the shower,
soaped up, rinsed off real well, and left to dry for a couple days. Sure
it could ruin it completely, but you were planning to throw it away any-
how, right? And if it happens to be one of those keyboards that don't
mind water then it's fixed and you don't have to buy a new one after all!
All right, how about floppy drives? Yes, they need to be cleaned too,
with one of those disk drive head |ncleaning|n kits that you can find in most
any computer store. It's just like a |nfloppy|n disk, only instead of having
a real disk inside it, there's a round piece of a sort of |ncleaning|n cloth
in there. Well you put a couple drops of this |ncleaning|n fluid that comes
in the kit, onto the cloth thing, and stick it in the drive, and issue a
DIR command on that drive to make the heads try to access the disk. That
rubs the heads against the |ncleaning|n cloth for about fifteen seconds and
then you'll get the famous "|sAbort, Retry, Fail, Ignore|s" message because
of course the heads can't find the data on that disk. If it didn't last
fifteen seconds, then hit R for Retry and do it again. Then hit A for
Abort, and you have a clean floppy drive. But you should only do it once
every six months, or whenever you're getting a lot of read errors, which-
ever comes first. That little |ncleaning|n cloth is kind of abrasive and is
not really good for the drive. The drive does need to be kept clean, but
you mustn't use those |ncleaning|n kits as often as the instructions tell
you. Remember that the people who wrote those instructions just want to
sell you more kits, and since each kit is only good for a limited number
of cleanings, then if you use it more often, you'll have to buy a new one
sooner, and that's just what they want. Then your disk drive gets ruined
sooner too, and they can sell you another one of those as well. That
would make them real happy. But that's not what you want to do, is it?
You don't have to worry about your hard disks getting dirty, because they
are very well sealed. Nothing's going to get in there.
What is the |tFAT|t?
Well, it's only the single most important part of a disk. |nFAT|n stands for
File Allocation Table. You know how a book has a table of contents and
an index? Well if your two-year-old nephew ripped the table of contents
and index out of a book, you would still be able to read the information
in the book. You'd just have to page through it and look at the chapter
titles and stuff. Well DOS isn't that smart. If DOS can't look in the
index and see the page number it wants to turn to, it won't even consider
thinking about trying to find any information. It just won't even try.
Well the root directory of a disk is like the table of contents of a
book. It tells DOS what the first page number (cluster number) of each
chapter (file) is. But the |nFAT|n is even more important than that. Be-
cause files get fragmented. That means one fragment of a file gets stuck
over here on the disk, and another part of the file gets put over there
on the disk. It's not like a book, where all the pages of a chapter are
in the same place, one right after the other. Well DOS needs to look in
the index (FAT) of the book (disk) to see where all the other references
to that chapter (file) are at on the disk.
The directory entry for a particular file includes the cluster number for
the first cluster of that file. Now the |nFAT|n entry for that cluster tells
the number of the next cluster of the file. And the |nFAT|n entry for that
next cluster tells the number for the next cluster after that. And even-
tually one of the |nFAT|n entries will be the one that contains a special
character that says it's the last cluster of that file.
Well that's just about all you really need to know about the |nFAT|n. With-
out it, DOS won't even make an attempt to find your files on your disks.
The |nFAT|n is so important that DOS keeps two identical copies of it, just
to be on the safe side.
The |tAbort, Retry, Fail, Ignore|t Error Message
Here's something you're going to see about a zillion times. Practically
every time anything goes wrong with a disk read or write, DOS is going to
tell you a short explanation of the problem and then show you this mess-
age as well, so you can decide what you want to do about that problem.
Well if it's a problem you can do something about, like putting the right
disk back into the drive, or removing the write-protect from the disk, or
closing the door on the drive, then do it and press R for Retry, and ev-
erything will be fine. If it's not that simple, press R anyway and see
what happens. If the same message comes back again, try R again a couple
more times and if you're still getting the same message, then choose A
for Abort, but be aware that what that will do is cancel the entire pro-
gram that asked for the disk access. So you might lose some data. The
only time I can think of that you'll need the Fail option, is if you have
$P$G as your prompt, and you forget and take the disk out of the drive
before you switch back to the hard drive. Don't ever use the Ignore op-
tion unless you know exactly what you're doing. What that one will do,
is allow the program to continue, without making the read or write on the
disk. So don't ever choose Ignore.
You know the |nprompt|n that appears on your screen whenever DOS wants to
know what you want to do next. It looks like this:
Boring, isn't it? But did you know that you can make the |nprompt|n say any-
thing you want it to say? With the |nPROMPT|n variable in the |senvironment|s!
If you type this at the command line:
Then your |nprompt|n will be
instead of the usual C>. Notice that in most cases, you need to use the
SET command to set an |nenvironment|n variable, but for PATH and |nPROMPT|n, the
|nSET|n command is not required. Also, on some systems, an equals (=) sign
is required between the word |nPROMPT|n and the rest of the statement. So if
|nPROMPT|n Hello doesn't work on your system, use |nPROMPT|n=Hello instead.
There are many special symbols you can use to get special characters into
$$ a $ symbol $_ a carriage return
$b a || symbol $d the |ncurrent|n date
$e an ESCape character $g a > symbol
$h a backspace character $l a < symbol
$n the |ncurrent|n drive $q a = symbol
$p the |ncurrent|n |ndirectory|n $t the |ncurrent|n time
$v the DOS version $ (space + $) a trailing blank
The most commonly used |nPROMPT|n metacharacters are $p$g. This |nprompt|n shows
what your current directory is at all times. For example if your |ncurrent|n
|ndirectory|n is C:\DOS, then your |nprompt|n will be C:\DOS>. If you change to
the C:\UTIL |ndirectory|n, using the CHDIR command, then the |nprompt|n immedi-
ately changes to C:\UTIL>. You almost always want to use this as part of
your |nprompt|n if you're using a hard disk, so you never forget where you
are. The only problem with this |nprompt|n is that it causes DOS to look at
your disk after every command, to see what the |ncurrent|n |ndirectory|n is, so
that it can display the |ncurrent|n |ndirectory|n's name. Well the reason this
can be considered as a problem, is that if you switch the |ncurrent|n drive
to a floppy disk, using the A: or B: command, before you put a disk into
that drive, you'll get an "|sAbort, Retry, Fail, Ignore|s" message. It also
really slows things down on a |nfloppy|n drive, because it takes DOS so much
longer to look at a |nfloppy|n disk than to look at a hard disk.
So whenever you're about to switch over to work on a |nfloppy|n disk for a
while, you might want to issue the |nPROMPT|n command all by itself, with no
parameters. What that will do is to reset the |nprompt|n to the default (the
|nprompt|n that DOS would normally use unless you gave it some other |nPROMPT|n
command), which is just the equivalent of $n$g, which only shows the cur-
rent drive, instead of the current drive and directory. That way, DOS
doesn't have to look at the disk after each command to read the |ncurrent|n
For more information on great things you can do with the |nPROMPT|n command,
see the section about ANSI.SYS.
One concern that comes up quite frequently, is that a body sometimes gets
a double |nprompt|n on his screen after running a batch file. By that I mean
that the |nprompt|n looks like this:
There are four things that I can think of right off the bat, that can
cause this little annoyance. First, most any |nbatch file|n that doesn't
have "|nECHO|n OFF" in it, will do that. Second, a lot of people have the
mistaken impression that they have to turn ECHO back on at the end of a
|nbatch file|n. Not true. DOS turns |nECHO|n on at the end of every |nbatch file|n
whether the command is given or not. The only thing an "|nECHO|n ON" line at
the end of a |nbatch file|n does, is to take an extra couple of milliseconds
to process the |nbatch file|n, and to cause that nasty double |nprompt|n display.
One other thing that can cause it, is having an extra carriage return
of these seems to be the problem, you can just use EDLIN to remove the
carriage return from the last command in the |nbatch file|n. To do that,
just retype the line and hit the
That'll do it. But it's not a good idea. You really want all your batch
files to end with a carriage return. (Not more than one, though.)
PLEASE IGNORE THIS PAGE!