home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
dosutils
/
dosimp10.arj
/
SIMPLY5.HYP
< prev
next >
Wrap
Text File
|
1991-08-12
|
109KB
|
1,995 lines
The |TDOSSHELL|T Command
The first thing I have to say about the DOS Shell is that I'm sorry. I
really am. I just can't do this. I wanted to work with the Shell for
a while and learn how to deal with it, so that I could do a good job of
writing about it. But I just can't do it. I hate Shells. I tried, I
really did. But I can't. Forgive me? I'll tell you everything I know
about it, though.
First, what is the DOS Shell? Well it's a menu-driven mouse-supporting
interface that "protects" you from having to deal with DOS. (Now you can
see why I hate it, because I love DOS and don't want to be protected from
it.) It shows you a menu of things that you can do, and you use the ar-
row keys or the mouse to choose the thing you want to do, and it does it
for you. You don't have to know any DOS commands or anything to be able
to use it. Of course you do have to know about DOS in order to be able
to configure it to your personal taste, and to add your own menu choices
to it and stuff.
<page down> for more
DOSSHELL continued
When you enter the |nDOSSHELL|n command, after a minute, you will see the
Shell. To get the menus, just hit the <Alt> key and the menu bar will
light up, you just type the letter that stands for the menu you want to
see. Then you type the letter that's highlighted in the option you want
to choose from that menu. Or you can use the <Left> and <Right> arrows
to move to another menu, or you can use the <Esc> key to get out of the
menus altogether. To get help, just hit the <F1> key.
The version 4 DOS Shell requires that you use the APPEND command so that
the Shell will be able to find its companion files. But the |nAPPEND|n com-
mand is not a good thing to use. Besides that, it's a TSR so it's really
a waste of memory. There's a way to get around the need for the |nAPPEND|n
command though. Just edit the |nDOSSHELL|n.BAT file, add the lines C: and |nCD|n
C:\DOS at the beginning, and CD\ at the end. This will change to the DOS
directory before running the Shell, so that all the companion files will
be in the current |ndirectory|n and the Shell will be able to find them even
without the |nAPPEND|n command.
<page down> for more
DOSSHELL continued
Well one thing that causes a lot of trouble for DOS Shell users is that
when you use <Shift-F9> or "Command Prompt" to get to a DOS prompt, that
doesn't mean you've exited the Shell. It just means you're shelling out
to a secondary copy of COMMAND.COM. If you turn off the computer at that
point, the DOS Shell will leave a temporary file behind, with a name like
10370F37 or something like that. In order to have the Shell delete its
temp files, you have to really and truly exit the Shell via the Exit op-
tion on the Files menu, or by using the <F3> key (more than once if nec-
essary, depending on what part of the Shell you're in at the time).
If you want to be able to print files from within the DOS Shell, you have
to first install the PRINT TSR from the command line. (Not, and I repeat
not, from within the Shell. Exit the Shell completely first.) Just type
|nPRINT|n <Enter>, and it will ask you what port your printer is attached to.
If it's on LPT1 then hit <Enter> again, and otherwise tell it the correct
port and hit <Enter>. When you go back into the Shell, your Print option
on the Files menu will work. If you really want to be able to print from
within the Shell all the time, and you have the memory to spare, then you
<page down> for more
DOSSHELL continued
can put |nPRINT|n /D:|nLPT1|n (or |nPRINT|n /D:|nCOM1|n if your printer is attached to
that port instead) into your AUTOEXEC.BAT. Then the print option in the
Shell will be active at all times. Your screen will start displaying a
message about the print queue being empty every time you boot your compu-
ter, but that's ok, that's what it's supposed to say because you haven't
told it yet what file you want to print.
Well that's about all I know about the version 4 DOS Shell. The one in
version 5, on the other hand, has some extra features over the old one.
Best of all, it's got a task switcher.
What's a task switcher? Well, you know how if you're in the middle of
one application and you need to get some information out of another? You
have to save whatever you're working on in the app you're in, and exit
it, and start up the other app, get the info you wanted from it, exit
that one, and start the first one back up, and find the point where you
had left off. Well, a task switcher allows you to have more than one app
open at a time, and switch back and forth between them. The ones that
<page down> for more
DOSSHELL continued
are in the background aren't actually running. They're just sort of in
limbo, so it's not like running a multitasker. But it's a lot easier
than exiting and starting and exiting a bunch of applications.
When you swap from one application to another, everything that's in RAM
is copied to your hard drive for storage, so that when you switch back to
that app, whatever is now in memory is copied to a different swap file
and that first swap file on the hard drive is copied back into |nRAM|n and
you're right where you left off in that first app before you swapped to
the second one, and the second one is sitting on the hard drive ready for
you to swap back into it. (These swap files are huge and they are also
Hidden files, so if you reboot from inside an app, they'll stay on the
hard drive but you won't notice until your hard drive space disappears.)
All you have to do to be able to do task switching with version 5.0's
Shell, is to pull down the Options menu and put your cursor on Enable
Task Swapper and hit the <Enter> key. That should put a little diamond
on that line right next to the Enable Task Swapper option, and now you
<page down> for more
DOSSHELL continued
can start one program, then hit <Ctrl-Esc> to get back to the DOS Shell,
and start another program, etc.
The task swapper uses whatever directory is referenced by the TEMP vari-
able in your environment, so if you have enough memory to make a really
big (at least one meg) RAMdisk, and supposing that your |nRAMdisk|n's drive
letter is E:, then put |nSET|n TEMP=E:\ into your AUTOEXEC.BAT, then the task
swapper will put all its swap files there. (Until the |nRAMdisk|n fills up,
that is. If you have a whole bunch of applications active at once, then
the overflow will go into your C:\DOS |ndirectory|n.) Two benefits of this.
First, a |nRAMdisk|n is about a million times faster than a hard drive. And
second, the |nDOSSHELL|n and the task swapper are all the time creating these
little temporary files and leaving them lay around in whatever |ndirectory|n
is listed in your TEMP variable. Those files automatically get deleted
whenever you exit the application involved or the |nDOSSHELL|n itself. But
sometimes your machine locks up and you have to reboot it, so those temp
files don't get deleted. Well if they're on the |nRAMdisk|n, then the temp
<page down> for more
DOSSHELL continued
files don't just hang around waiting for you to find them and start won-
dering where they came from, because everything on a RAMdisk is erased
when you reboot. So those files are gone, out of your way.
The |nDOSSHELL|n is a really good candidate as a program that can be run from
a |nRAMdisk|n to speed it up. To do so, make sure the |nRAMdisk|n's root dir-
ectory is the very first directory listed on your PATH, and then put the
line |nCOPY|n C:\DOS\DOSS*.* E:\ into your AUTOEXEC.BAT file (that's again
assuming your |nRAMdisk|n is drive E:), and that way whenever you issue the
|nDOSSHELL|n command, DOS will run the copy that's on the fast |nRAMdisk|n in-
stead of the copy of the program that's on the slow hard disk. But, one
thing you want to remember if you do that, is if you make any changes to
the |nDOSSHELL|n's configuration, you will need to COPY the |nDOSSHELL|n.INI file
back to your C:\DOS |ndirectory|n before you turn off the computer. Or else
the changes you made will be gone the next time you boot up the computer.
If you have an EGA monitor you will want to install EGA.|nSYS|n, which is a
device driver that you use by putting a DEVIC|1E or DEVICEHIGH command into
<page down> for more
DOSSHELL continued
your CONFIG.SYS file. Otherwise, every time you switch between one ap-
plication and another, it's likely that the screen will be all messed up.
Make absolutely sure that the Select Across Directories choice in the Op-
tions menu, is not enabled. Use that option only when you need to, and
remember to always turn it back off as soon as you're done with whatever
you needed it for! Otherwise, whatever filename the cursor was sitting
on when you first entered the Shell, will be one of the ones deleted, or
copied, or whatever, when you do anything that can affect more than one
file at a time. Really terrible things can happen to your files if you
leave Select Across Directories enabled!
With DOS 5.0's Shell, it's really easy to customize the colors exactly to
your own taste. Just use the EDIT command to edit the |nDOSSHELL|n.INI file,
go near the end where you can see a bunch of colors written, pick out one
of the combinations that you're sure you will never want to use, such as
hot pink, and change all its colors, save the file, and the next time you
go into |nDOSSHELL|n choose the combination you edited, and it'll be the one
<page down> for more
DOSSHELL continued
you created instead of the one that used to exist under that name.
You want to be careful how you change it though. I mean if you want to
change blue to green, then change all of the blues to green, and don't
change anything else to green. The same for any other color. Because
if you accidentally change, say, the foreground of the menus to red and
change the background of the menus to red as well, you won't be able to
read a word of the menus.
Speaking of colors, if you use ANSI.SYS and ESC sequences to change the
colors of your DOS screen, the Shell will probably mess them up when you
exit back to DOS. If the color choice includes a colored background your
screen will be black, and just the prompt itself will be your chosen col-
ors when you exit the Shell. To fix that problem up, you just need the
CLS command. So if you use a DOSKEY macro like DS=DOSSHELL $T |nCLS|n then
your screen will get cleared for you, to the proper colors, each time you
exit the Shell, even if you just shell out using "Command |nPrompt|n" or the
<Shift-F9> option. I'm not sure why it works in those cases but it does.
<page down> for more
DOSSHELL continued
If you run a program from within the Shell, that requires that you load
some TSR, then run the program, then unload the |nTSR|n, then when you exit
that program you'll get a screen that says something about "pop-up sup-
port" and tells you to press <Ctrl-C> to continue. That's ok, because
it's supposed to do that, to make sure that |nTSR|n that got loaded, gets
properly removed from memory before going back to the Shell.
You mustn't ever run commands such as CHKDSK with the /F switch, or DEL
or ERASE or UNDELETE or such things that affect the information on your
disk while you have another program running in the task switcher! Be-
cause you don't really have any way of knowing for sure what disk files
the other program has open at the time. Really awful things can happen
if you do those commands while another program is running.
Even |nCHKDSK|n without the /F switch will do funny things if run from in-
side the |nDOSSHELL|n. Because there are temp files open while the Shell is
in use, and |nCHKDSK|n will think that those are lost clusters. If you exit
the Shell with <F3>, then run |nCHKDSK|n again, it won't find any lost clus-
<page down> for more
DOSSHELL continued
ters after all. What a relief, right?
You can make the Shell do anything you want it to do by adding a new item
to the menu. To do that, you choose "New" from the Files menu while your
cursor is on the Main Group. On the Properties window of the screen you
get when you do that, there's a space where you should enter the commands
you want the Shell to perform whenever you select this new menu item. In
that space, you can enter just about any commands you want, including the
use of environment variables, just like you were writing a batch file ex-
cept you can't use the GOTO and SHIFT commands, and you separate commands
with " ; " (a semicolon surrounded by spaces) instead of a touch of the
<Enter> key. And the @ symbol doesn't work in these "pseudo-batch files"
but that's ok because ECHO is automatically off. Be sure to notice the
Pause option on that Properties screen. If there's an X next to it (the
|sdefault|s) then when your "pseudo batch" commands are done, you'll get a
"Press any key" message before you go back to the Shell. That's for in
case your command displays something on the screen at the end, that you
need to see. If your command doesn't do that, and you don't want it to
pause, hit the <Space> bar on that Pause option to remove the X.
The |TMODE|T Command
This command has about a million uses. This is going to be a long sec-
tion. I think that the most common use for it is to change the video
mode after some program (usually a game) has messed it up. If you exit
a program and your screen has letters that are twice their normal size,
or your screen is so messed up that you can't even tell you have a prompt
or cursor, try typing |nMODE|n CO80 (that's C-Oh-Eight-Zero) and hit <Enter>.
There, is that better? That stands for COlor and eighty columns, so if
you don't have a color monitor, use BW80 instead, because that stands for
Black and White and eighty columns.
If you have trouble seeing the little letters on the screen, try |nMODE|n
CO40 and see if that helps. Of course most applications that you run
are going to set it back to CO80, so you'll have to keep setting it back
to CO40 every time you exit back to DOS. But a batch file can make that
easy on you.
If you have DOS version 4 or 5, you can use the |nMODE|n command to change
<page down> for more
MODE continued
your keyboard repeat rate. You know when you hold a key down it is sup-
posed to zoom across the screen typing that same letter or function over
and over again? Well it doesn't "zoom" very well until you do something
to raise the repeat rate. The version 4 |nMODE|n command can do that. |nMODE|n
CON: DELAY=## RATE=## is what the command would look like to perform that
function, and you just need to figure out what you want to use in place
of ##. The DELAY= number means how long you want to have to hold down
the key before it starts repeating. You can use the numbers 1 through
4, and they represent quarter-seconds. If you use DELAY=1, then if your
finger accidentally holds the key down for one quarter of a second, what-
ever letter you're holding down will start zooming across the screen. If
you use DELAY=4 you'll have to hold the key down for a full second before
it will start repeating. The RATE= parameter specifies approximately how
many times per second the key should repeat. You can use any number from
1 to 32. I use |nMODE|n CON: DELAY=2 RATE=32 in my AUTOEXEC.BAT file. And
while this command is not a TSR, it does actually change one of the |sCPU|s's
registers, so this change you make with the |nMODE|n command will be effec-
tive in most of your applications, not just at the DOS command line. Of
<page down> for more
MODE continued
course some applications might reset it, so you would need to reset it
again. A batch file will make that easy for you. If you find an applic-
ation that resets the keyboard repeat rate (also called typematic rate),
then start that app from a |nbatch file|n, and have the |nMODE|n CON: command as
the last line of that |nbatch file|n, so that your repeat rate always gets
reset between the time you exit the app and the time you see your prompt.
Of course it's possible that this command won't affect your |nkeyboard|n at
all. It works on most systems, but not all. Can't hurt to try, though.
The default values are DELAY=2 and RATE=20. But if you change one, you
have to specify both in the command.
You can use the |nMODE|n command to tell your printer how many characters per
line and how many lines per inch to print. Of course most applications
that are designed to do any printing will reset the printer, but what you
set with the |nMODE|n command will work when you're in DOS, with the PRINT,
|nCOPY|n FILE PRN, or |nTYPE|n FILE > PRN commands. |nMODE|n LPT#:N,M,P is the for-
mat for this function of the |nMODE|n command. LPT# means which port your
printer is attached to. N means how many characters per line, 80 or 132.
<page down> for more
MODE continued
M means how many lines per inch, 6 or 8. The P you will probably want to
leave out. It means that if the printer tells the CPU it's busy, the |nCPU|n
will keep trying to send more data anyway. This is called continuous re-
try. If you do use the P and your system seems to hang up, you can break
out of it with <Ctrl-C> or <Ctrl-Break>. (The system will not respond
right away, though, it will take maybe half a minute.) This form of the
|nMODE|n command should only be used with Epson-compatible printers. If you
have DOS version 4 or later this form of the command changed also. |nMODE|n
LPT#: COLS=N LINES=M RETRY=P is what it's like now. The old form will
still work just fine, but if this form is easier for you, then use it in-
stead.
If you have DOS version 4.0 or later, and you have ANSI.SYS installed in
your CONFIG.SYS file, and you have an EGA or VGA display, then you might
use the |nMODE|n command to set your screen to 43 or 50 lines instead of just
25. |nMODE|n CON: COLS=M LINES=N would do it, where M can be 40 or 80, and N
can be 25 or 43, or if you have a VGA, then N could also be 50. And if
you install |nANSI.SYS|n with an /L switch, it will even try to force your
<page down> for more
MODE continued
applications to display in this higher number of lines per screen, and
leave the display in this mode when you exit back to DOS, although it
won't work for all applications.
You can also use |nMODE|n to set the parameters for your COM1 or other serial
port. Here's an example of the most common setting for this function of
the |nMODE|n command: |nMODE|n |nCOM1|n:2400,N,8,1,P where |nCOM1|n refers to the comm
port you're trying to set |nparameters|n for. 2400 is the baud rate, N means
no parity, 8 means 8 data bits per byte, 1 means 1 stop bit, and P means
continuous retry for when you're using a serial printer. The choices for
port number are 1 or 2 for DOS 3.2 or earlier, or 1 through 4 for DOS 3.3
or later. Baud can be 110, 150, 300, 600, 1200, 2400, 4800, or 9600, de-
pending on the rate supported by your modem and the modem you'll be call-
ing, and the conditions of the phone lines from here to there. DOS ver-
sion 3.3 adds a rate of 19200 to those choices. Parity can be None, Odd,
or Even. Data bits can be 7 or 8, stop bits can be 1 or 2, and the P can
be there or not. For DOS version 4, of course this form of the |nMODE|n com-
mand changed too. |nMODE|n COM#: BAUD=B PARITY=Y DATA=D STOP=S RETRY=P. Now
<page down> for more
MODE continued
you're probably thinking that this form of the command is only for modems
but that's not the case! In fact, it is rarely used for modems, because
most people use specialized communications software to work with the mo-
dem, and it sets the parameters for them. This form of the |nMODE|n command
is more often used for serial printers and mice and such things.
If you have a serial printer instead of a parallel printer, you need to
use the |nMODE|n command to tell DOS to send whatever data it would normally
send to LPT1, to your serial port instead. This command's syntax is a
lot easier than some of the other forms of the |nMODE|n command. It's like
this: |nMODE|n |nLPT1|n:=COM#: where # is the number of the serial port your
printer is connected to. But first you have to use the other |nMODE|n com-
mand above to tell your serial port what |nparameters|n to use. Yes, that's
right, the difficult one with the baud rate, parity, stopbits, and all
that. But your printer manual should tell you exactly which |nparameters|n
to use so you shouldn't have to figure it out by yourself. If you want
to put the printer output back to |nLPT1|n, then |nMODE|n |nLPT1|n: will do that.
<page down> for more
MODE continued
While most functions of the |nMODE|n command do not involve loading a TSR,
some do. If you see the message "Resident portion of |nMODE|n loaded", it
means that you did use one of the functions of the |nMODE|n command that
loads |nMODE|n as a |nTSR|n.
The |TJOIN|T Command
This is not exactly the safest of commands. If you ever have any desire
to try it, don't, unless you have a |ncurrent|n backup of all the disks that
will be involved. This command didn't exist until DOS version 3.1.
This command is used to join one disk drive to an empty directory of some
other drive, so that it will seem like the files on the drive are instead
files in the empty |ndirectory|n on the other drive.
The syntax is like this:
|nJOIN|n D: D:\DIR
Suppose you want the files on drive A: to appear that they are files in
the \OTHER |ndirectory|n on drive C:. You would first make sure you have an
empty |ndirectory|n (with no files or other subdirectories in it) named OTHER
branching from the root |ndirectory|n on drive C: (if there is no such direc-
tory, |nJOIN|n will create it), then issue the |nJOIN|n A: C:\OTHER command. Now
when you do a DIR of C:\OTHER, the access light on drive A: will light up
for a minute, and a |ndirectory|n listing of the drive A: files will appear.
<page down> for more
JOIN continued
Now if you issued the command |nDIR|n A:, you'd get an error message, "In-
valid drive specification" because drive A: doesn't exist anymore.
To show what drives might be under the effect of a |nJOIN|n command, just
enter |nJOIN|n all by itself, with no parameters, and it will say something
like A: => C:\OTHER and if you want to unjoin them, just do |nJOIN|n A: /D.
That puts everything on drive A: and C:\OTHER back to normal.
APPEND, ASSIGN, BACKUP, CHDIR, CHKDSK, DEL, DISKCOMP, DISKCOPY, ERASE,
FASTOPEN, FDISK, FORMAT, LABEL, MIRROR, MKDIR, PATH, PRINT, RECOVER,
RESTORE, RMDIR, SUBST, and SYS are all commands that shouldn't be used
with a |nJOIN|n in effect.
The |TMEM|T Command
Don't you hate the way you have to use the CHKDSK command and wait for it
to finish looking at your disk, in order to find out how much free memory
you have at the moment? Well if you have DOS version 4 or later, there's
no need to use |nCHKDSK|n for that purpose anymore! That's what the |nMEM|n com-
mand is for.
Not only does it tell you how much |nmemory|n is currently free, it can also
tell you a whole bunch of other information if you ask it to real nicely.
You can use |nMEM|n all by itself or with the /P, /D, or /C switches, and |nMEM|n
will tell you a different amount of information depending on which switch
you use. The /C switch is the one you want to use if you have DOS 5 and
you want to see what's going on in the Upper |nMemory|n Blocks.
If you're using the HIMEM.SYS device driver and the |nMEM|n command tells you
that your available extended |nmemory|n is zero, don't panic. Look where it
says how much available XMS |nmemory|n you have. That's where your |nextended|n
<page down> for more
MEM continued
memory went. XMS |nmemory|n is just extended |nmemory|n that's being managed by
an |neXtended|n |nMemory|n Specification 2.0 device driver. If you have an ap-
plication that uses |nextended|n |nmemory|n but cannot use |nXMS|n 2.0 |nmemory|n, then
you want to tell HIMEM.SYS not to convert all the |nextended|n to |nXMS|n. To do
so, you use the parameter /INT15=### where ### is the number of Kilo|sbytes|s
you want to leave as plain old |nextended|n |nmemory|n instead of |nXMS|n, plus 64K.
For example, if you want to keep 256K of |nextended|n |nmemory|n, then you would
use this command in your CONFIG.SYS file:
DEVICE=C:\DOS\HIMEM.|nSYS|n /INT15=320
because 256+64=320, so that will leave you with 256K of |nextended|n |nmemory|n,
and the rest will still be converted to |nXMS|n |nmemory|n.
If the |nMEM|n command doesn't report anything about EMS |nmemory|n, then that
means that either you don't have any expanded |nmemory|n, or else that your
|nexpanded|n |nmemory|n is not LIM 4.0 compatible. |nMEM|n won't say anything about
|nextended|n |nmemory|n either, if you don't have any of that.
The |TMIRROR|T Command
This command is new to DOS version 5.0, but many of us have been using it
for quite some time. Microsoft licensed it from Central Point Software,
the makers of PC Tools. It performs two great functions. First, every
time you reboot the computer it stores a copy of your FAT, |nboot|n record,
and root directory in a nice safe place, for in case your originals get
trashed, then you can use the UNFORMAT command to put them back together
again. The files that |nMIRROR|n makes are called MIRORSAV.FIL, which has
its Read-only, System, and Hidden attributes turned on, and |nMIRROR|n.FIL
and |nMIRROR|n.BAK which have their Read-only |nattributes|n turned on. These
files are going to go into your |nroot|n |ndirectory|n whether you like it or
not. There's no way you can put them somewhere else because if you do,
the program will just create new ones in the |nroot|n |ndirectory|n the next time
you |nreboot|n. But you don't have to leave them visible in your |ndirectory|n
listing. The program recreates them each time, so you can't just turn on
their Hidden |nattributes|n and leave it at that. The next time you boot up,
they will be recreated without any Hidden |nattributes|n. But you can put
the command |nATTRIB|n +H |nMIRROR|n.* into your AUTOEXEC.BAT file right after
<page down> for more
MIRROR continued
the |nMIRROR|n command, and you'll never see those files in a DIR listing
again unless you use the /A switch with the |nDIR|n command.
Also, if you use the /T switch, |nMIRROR|n will install a TSR called Delete
Tracking. This one watches everything you do, and whenever you (or any
program) try to delete a file, it keeps a record of it and stores that
record in a file named PCTRACKR.|nDEL|n in your root directory, so that if
you should end up wanting to undelete the file, all the information the
UNDELETE command will need will be right there in that file, so that you
have a 100% chance of getting all of the file back unless you (or some
program) have written something to the disk in the spot where the file
was, between the time you deleted the file and the time you used the UN-
DELETE command on it. This PCTRACKR.|nDEL|n file has its System attribute
turned on, so you won't be bothered with looking at it in your |nDIR|n list-
ings all the time. It's also pretty difficult to delete this file. Be-
cause it keeps a record of every file you delete, if you delete it, it
reconstructs itself immediately in order to store a record of the fact
that you just deleted it. The only way to get rid of it is to reboot the
<page down> for more
MIRROR continued
computer without the /T switch in the |nMIRROR|n command in your AUTOEXEC.BAT
file, and then delete it.
One thing you do not want to do if you ever do the command FORMAT C:, or
RECOVER C:, or DEL |n*.*|n, or ERASE |n*.*|n in the root directory, is reboot the
computer to see if the problem clears up. Sometimes rebooting can cure a
multitude of ills in a computer, but not in this case. And because MIR-
ROR stores the two most recent mirror images of your FAT and |nroot|n direc-
tory, if you |nreboot|n once after you trash your drive, then your first copy
of the mirror image is bad, and if you |nreboot|n again, now both your copies
are bad and it's like as if you never used |nMIRROR|n in the first place. In
that case, the UNFORMAT command will have a terrible time trying to help
you. So don't do that. If rebooting once doesn't fix it, then rebooting
again won't either, and just destroys most of your chances for recovery.
The syntax for this command is like this:
|nMIRROR|n D: D: D: /1 /TD-## /TD-## /TD-##
where the D:s are the drive letters for which you want to save the |nFAT|n
<page down> for more
MIRROR continued
and root directory information, /1 means you only want to save the most
recent copy instead of the two most recent copies, the Ds with the /T
switches tell what drives you want delete tracking installed for (that's
right, it's one of the rare times you want to refer to a drive letter
without including a colon), and the ##s stand for how many entries you
want to save for each drive. For example, here's the command I have in
my AUTOEXEC.BAT file:
|nMIRROR|n C: /TC-50
which means to save the FAT and |ndirectory|n information for the C: drive,
and install delete tracking to monitor deletions on the C: drive and save
information on only the 50 most recent files that I've deleted.
|nMIRROR|n C: D: /TC-100 /TD-50 /TE-25
would save the |nFAT|n and |ndirectory|n information for drives C: and D:, and
load delete tracking to save information on the most recent 100 deletions
on drive C:, the most recent 50 deletions on drive D:, and the 25 most
recent deletions on drive E:.
The value you use for the -## parameter can be from 1 to 999, and the
<page down> for more
MIRROR continued
default depends on the size of the disk in question. If you have a hard
drive larger than 32M, the |ndefault|n will be a 55K file containing records
of the 303 most recent files you deleted.
You can unload the deletion tracking TSR by using the /U switch, as in
|nMIRROR|n /U, but it only works if you haven't loaded any other TSRs since
the time you loaded |nMIRROR|n, or if you unload the later TSRs first.
Of course, for the |nMIRROR|n command to work its magic, it has to be run
every day, and that means putting the command in your AUTOEXEC.BAT file.
The Hidden file that |nMIRROR|n saves the data in, MIRORSAV.FIL, gets stored
in the very last cluster on your hard drive, and if that spot on your
disk is bad, |nMIRROR|n will take a long time to run each time. So if you
find that it's taking a long time, you will want to run a surface scan
utility which will mark out bad clusters in the FAT, as if they were al-
ready in use, so that DOS won't put any files in that spot. Then the
MIRORSAV.FIL will go in the next-to-last cluster on the disk instead, and
<page down> for more
MIRROR continued
won't take so long to run, and will be a lot more reliable that way any-
how.
One more thing that the |nMIRROR|n command can do is to save a copy of your
hard drive's partition table to a floppy disk. To do that, just enter
the command |nMIRROR|n /PARTN with a disk in drive A:. This will allow you
to recover from an "Invalid drive specification" error message, if you
ever receive such a thing in reference to your hard drive. You only need
to do this command one time in your life, unless you repartition your
drive (with the FDISK command, most likely), but make sure you don't lose
the |nfloppy|n that you saved that information to. The file |nMIRROR|n /PARTN
will create on that |nfloppy|n disk will be called PARTNSAV.FIL.
The |TUNFORMAT|T Command
This command is new to DOS version 5.0, but it's been around for a while.
Microsoft licensed it from Central Point Software, the publishers of PC
Tools, where its name was REBUILD. It does just what its name implies.
In order for the |nUNFORMAT|n command to work, the disk it's being used on
needs to have been formatted by the DOS version 5.0 FORMAT command, and
without the /U switch. Because this new safe |nFORMAT|n command runs MIRROR
on the disk before it formats, to save a copy of the root directory and
FAT in the |nMIRROR|n.FIL file. (You won't need to have the |nMIRROR|n.COM file
available though, because the applicable parts of MIRROR's code are in-
side the |nFORMAT|n.COM file.) You won't be able to see that |nMIRROR|n.FIL file
on the disk, but unless you used the /U switch with the |nFORMAT|n command,
and if there was enough blank space on the disk to fit the file, then it
will be there. (If there isn't enough room for this file, |nFORMAT|n will
tell you, so it won't just pretend like it's working and then surprise
you later.) And the |nUNFORMAT|n command will be able to use that little
file to put the disk back to exactly the way it was before you acciden-
<page down> for more
UNFORMAT continued
tally formatted it. Even if you did use the /U switch with the FORMAT
command, if you have used the MIRROR command on that disk very recently,
there's a good chance that the |nUNFORMAT|n command will be able to help you.
The |nUNFORMAT|n command can also undo the horrors caused by the RECOVER com-
mand when it's been used on a whole disk or directory instead of only on
one file at a time like the poor misunderstood |nRECOVER|n command is meant
to be used. Also, |nUNFORMAT|n can undo a |nDEL|n \*.* which means deletion of
all the files in the root |ndirectory|n. And finally, if you have ever used
the |nMIRROR|n /PARTN command and still have the floppy disk that information
was saved to, then |nUNFORMAT|n can restore the partition table on your hard
drive, which is what needs to be done if you receive the message "Invalid
drive specification".
Just be careful with the |nUNFORMAT|n command! Don't go using it at the drop
of a hat. It is there for the purpose of recovering from a major disas-
ter, not just for playing around with. It doesn't always work perfectly,
so if you use it on a small mistake you could end up in worse shape than
<page down> for more
UNFORMAT continued
you already were in. However, if you make a huge mistake, the |nUNFORMAT|n
command will leave you better off than you were even if it isn't able to
completely recover everything.
And don't dilly-dally around, between the time you make the horrible mis-
take and the time you get busy and decide to use |nUNFORMAT|n. If it's going
to be done, it needs to be done right away. Anything you do between the
mistake and the |nUNFORMAT|n could overwrite the data that you're hoping to
recover. And data that has had more data written on top of it can never
be recovered. Don't forget that an awful lot of DOS operations, like any
use of the || symbol or the DOSSHELL for example, writes temporary files
to the disk that you might not be aware of. Just because you have not
personally written anything to the disk since the mistake, doesn't mean
that DOS hasn't done so. The longer you wait before using |nUNFORMAT|n, the
greater the chance that the data will be overwritten before you can re-
cover it.
Here's the syntax for this command:
<page down> for more
UNFORMAT continued
|nUNFORMAT|n D: /J /L /P /PARTN /TEST
where D: is, of course, the drive which holds the disk you want to fix.
The /J switch just tells |nUNFORMAT|n to check to see whether there are any
|nMIRROR|n.FIL and |nMIRROR|n.BAK files on the disk, and that they don't disa-
gree with the system information. You don't use any other switches along
with this one! When it's done, then you redo the |nUNFORMAT|n command with
some other switches instead of this one. The |nUNFORMAT|n /J command doesn't
fix anything, or write anything to the disk.
The /L switch does not use the MIRROR files to help rebuild the drive in-
formation. It just does its best with what's left of the directory.
The /P switch makes |nUNFORMAT|n send all the data that would normally go to
the screen, to the LPT1 printer port instead. You don't need this at all
if you have |nMIRROR|n files on the disk; only if you're using the /L switch.
The /PARTN switch is what makes |nUNFORMAT|n restore the partition table that
<page down> for more
UNFORMAT continued
you had saved to a floppy disk ages ago with the |nMIRROR|n /PARTN command.
You don't use any other switches along with this switch except maybe the
/L switch which, when used with /PARTN, displays the partition table that
it's restoring. When |nUNFORMAT|n /PARTN is done, you will have to reboot
from a |nfloppy|n disk and then use |nUNFORMAT|n to restore your directory and
FAT.
The /TEST switch causes the |nUNFORMAT|n command to just pretend like it's
recovering your disk, and it just shows you what it would be doing if you
had not used this switch, so that you can decide whether unformatting is
a good idea or not. The |nUNFORMAT|n /TEST command does not change anything
on the disk. This is only relevant if you haven't been using the MIRROR
command, or if you rebooted twice since the damage occurred, or if you
rebooted once and ran the FORMAT command once, so that both of your MIR-
ROR files are trash as well.
As long as a disk was not formatted with the /U switch, then |nUNFORMAT|n can
put it back to the way it was just before it was formatted. If the /U
<page down> for more
UNFORMAT continued
switch was used with the FORMAT command, but if MIRROR had also been used
on that disk before, then |nUNFORMAT|n still has a chance, though not a great
one. And if it does anything in this case, it'll be putting things back
to the way they were at the time you last used the |nMIRROR|n command, so any
new files you have created since then will be lost, and any files you've
edited since then may be lost.
If you delete all the files in your root directory, don't use |nUNFORMAT|n to
get them back unless you already tried UNDELETE and that didn't work.
If you use the |nUNFORMAT|n command without the /L switch, the |nMIRROR|n file
will be used to help reconstruct the data. First |nUNFORMAT|n will show you
the date and time of the two |nMIRROR|n files (if the /1 switch was used with
the |nMIRROR|n command, or if |nMIRROR|n has only been used once on that disk,
there will only be one file from which to choose) and ask if you want to
use the Latest one or the Previous one. If you have |sreboot|sed the compu-
ter with the |nMIRROR|n command in your AUTOEXEC.BAT file, or if you have
formatted a corrupted disk, or in any way used the |nMIRROR|n command since
<page down> for more
UNFORMAT continued
the disaster happened, say P. Otherwise, say L. If it's on a floppy,
it's a really good idea to make two |sDISKCOPY|ss of the disk and try one
method on each of them; the Latest MIRROR file, the Previous |nMIRROR|n file,
and the |nUNFORMAT|n /L method. That way you have the greatest chance of re-
covering the data, even if you make the wrong decision as to which method
to use, because you have chosen all methods. It's too bad you can't use
|nDISKCOPY|n with a hard disk so that you could do the same thing.
If the disaster from which you want to recover was caused by something
other than DOS version 5's safe FORMAT command, and you've never used the
|nMIRROR|n command on that disk, or if the |nMIRROR|n file on the disk is very
old, or if the |nMIRROR|n file was created or updated after the disaster hap-
pened, then you'll need to try the |nUNFORMAT|n /L command. This method will
try to recover whatever it can from the directory entries on the disk.
You will definitely want to only use this command on a |nDISKCOPY|n of the
original disaster-disk. It may or may not help. If you do it on a copy
of the disk, then if it doesn't work you still have the original, and
maybe some utility package such as the Norton Utilities might be able to
<page down> for more
UNFORMAT continued
do a better job of recovery. But if you try |nUNFORMAT|n on the only copy of
the disaster-disk, and it doesn't work, then it's too late for Norton to
be able to help.
If |nUNFORMAT|n /L finds a file that is fragmented, it will ask you whether
it should truncate the file (cut it off at the end of the last contigu-
ous cluster) or delete it (so that you can try to manually undelete it
with a utility such as PC Tools or the Norton Utilities). Unless you
know an awful lot about manual undeletion, you won't be able to do any-
thing with it so go ahead and say Truncate so that at least you get part
of the file back. Of course this only applies to data files. If it's an
executable file, go ahead and say Delete because it won't be a bit useful
anymore.
The |TUNDELETE|T Command
This command is new to DOS version 5.0, but it's been around for a while.
Microsoft licensed it from Central Point Software, the publishers of PC
Tools. It does just what its name implies.
First of all, the DEL and ERASE commands have never deleted any of the
data in your files. All they do is erase the FAT entry, and the first
letter of the filename in the directory entry. They don't even touch the
file. Well the |ndirectory|n entry tells the location of the beginning of
the file, so all that's missing after a file has been deleted, is the
first letter of the filename, right? That should be really easy to fix.
Wrong. Because the |ndirectory|n entry tells the location of only the begin-
ning of the file, not all the other little pieces of a file. That's what
the |nFAT|n does. It tells the location of all the other parts of the file
after the first. This is especially important for fragmented files!
Well, if you've been running the MIRROR program with its deletion track-
ing TSR, then it's been saving a record of the |nFAT|n and |ndirectory|n entries
<page down> for more
UNDELETE continued
for every file you've deleted. So as long as neither you, nor DOS, nor
any other program has written any data, including the temp files caused
by the DOSSHELL or any redirection operations involving the || symbol, to
the spot on the disk where that file was, then the |nUNDELETE|n command can
easily, immediately, and perfectly restore any file you delete.
Even if you weren't running |sMIRROR|s's delete tracker, as long as no data
has been written on top of the deleted file, the |nUNDELETE|n command has a
chance of being able to work. As long as the file was not fragmented, it
will be able to restore everything except the first letter of the file-
name. Well you can just use the RENAME command to fix that part. If the
file was |nfragmented|n, you're in trouble. If the file in question is on a
floppy disk, make a DISKCOPY of it and see what the |nUNDELETE|n command can
do for you, but only on the copy, not the original. If it doesn't work,
you still have the original so you can take it to someone who knows more
about manual undeletion than you do.
Think long and hard whenever you're about to use the RMDIR command, be-
<page down> for more
UNDELETE continued
cause the |nUNDELETE|n command cannot bring back a directory, or any files
that were in a |ndirectory|n after it's been |sRMDIR|sed. If the |ndirectory|n is a
branch right off the root |ndirectory|n, then the UNFORMAT command might be
able to get it back, and then you could use the |nUNDELETE|n command to re-
trieve the files that were in that |ndirectory|n. But it's not a good idea
to go around using the |nUNFORMAT|n command just for one |ndirectory|n. It could
do more harm than good.
Here's the syntax for this command:
|nUNDELETE|n D:\DIR\FILENAME.EXT /ALL /DOS /DT /LIST
If you leave out the file specification there, then the command will un-
delete all the deleted files in the current |ndirectory|n.
The /LIST switch doesn't undelete any files. It just shows you which
files are available for undeletion, depending on whether you specify the
/DOS or /DT switch with the /L one.
The /ALL switch just goes right ahead and undeletes all the files that
<page down> for more
UNDELETE continued
there are to be undeleted, without asking for permission or anything. If
there is no delete tracking file to help, it will put a # sign in place
of the first character in each filename, and you can use the RENAME com-
mand to give the files back their real names.
The /DOS switch tells |nUNDELETE|n to ignore any delete tracking file and
just do what it can from the information in the deleted file's directory
entry.
The /DT switch undeletes only the files that have information stored for
them in the deletion tracking file.
If you don't specify any of these switches, the |nUNDELETE|n command will use
the delete tracker file if it exists, otherwise it will try the DOS meth-
od with just the |ndirectory|n entry to go on.
|tBoot|ting and |tReboot|ting
To "boot" a computer just means to turn on the power. This term comes
from the expression "pulling oneself up by the bootstraps". You see,
when a computer is not receiving any |npower|n, it obviously doesn't have
any software loaded into memory, so the computer is quite stupid at that
time. When you turn on the |npower|n, the computer loads the operating |nsys|n-
tem (DOS) into |nmemory|n, and suddenly it has become a useful piece of mach-
inery. So that's sort of analogous to the way a bum in the gutter might
"pull himself up by the bootstraps" and make something of himself.
To "reboot" a computer means to remove everything from the computer's
|nmemory|n and have it reload the operating system from the disk, just as if
the |npower|n had been turned off and back on. There are two different types
of |nreboot|n, and several ways to accomplish each. (See also Boo|1t Disk.)
First, a "cold boot" or "hard reboot" means to actually remove and re-
apply |npower|n. This is necessary sometimes when the computer has "crashed"
so hard that a warm |nboot|n won't even work. And that's the only time you
<page down> for more
Boot and Reboot continued
want to perform a cold |nboot|n, because a warm |nboot|n is a little bit easier
on the computer's components. That's why a warm |nboot|n is also known as a
"soft |nreboot|n".
A "warm boot" does not actually remove power from the computer, it just
clears out the RAM completely, causing the computer to reload DOS from
the disk. It fulfills the same function that a cold |nboot|n does, without
the shock to the system that is caused whenever |npower|n is reapplied to the
components.
So how do you accomplish a |nreboot|n? The easiest way is to hold the <Ctrl>
and <Alt> keys down, and hit the <Del> key. The Ctrl-Alt-Del method per-
forms a warm or soft |nreboot|n. There are also some public domain software
programs that can perform a warm |nboot|n from within a batch file.
Other |npublic domain|n programs can do a cold |nboot|n. Another way is to just
turn the |npower|n switch off and back on. But please, wait at least thirty
seconds between turning it off and turning it back on, to allow the hard
<page down> for more
Boot and Reboot continued
drive and the fan to stop spinning. It's best if you turn it off, then
go get a cup of coffee or something, then come back and turn it back on.
Remember that the hard drive is spinning at some amazing speed like 3000
revolutions per minute, the whole time it's on. Slowing it down (turn-
ing it off) and speeding it up (turning it back on) so quickly like that
is not good for it.
If you have a reset button on the front panel of your computer, it may
perform a warm or cold |nreboot|n, depending on the brand and model of your
machine. The easiest way to tell, is to see if your computer performs
the |TPOST|T when this button is pressed, or not. Power-On Self Test is what
that stands for, and it is performed by a program that's stored in a ROM
chip on your motherboard. This test is only performed when the power is
turned on, so obviously if your reset button causes the computer to do
the |nPOST|n then it's doing a cold |nboot|n. If your screen shows a little num-
ber up in the top left corner that counts up in increments of 64, then it
is testing your RAM and that's part of the |nPOST|n. If your reset button
does not cause the |nRAM|n test to occur, then it's doing a warm |nboot|n.
<page down> for more
Boot and Reboot continued
The problem with rebooting a computer is that even if you didn't do it
on purpose, it stills clears out every byte of everything in memory. So
save your work to disk, often! That way, if your computer locks up and
you're forced to |nreboot|n, then you only lose a little bit of work, what-
ever you've done since the last time you saved to disk.
See the section about the SHELL command for a quick description of what
the computer does while it's booting.
What Is |tCOMMAND.COM|t?
This is one of the top three most important files on your system. The
others are IO.SYS and MSDOS.SYS for MS-DOS, or IBMBIO.COM and IBMDOS.COM
for PC-DOS. Without these three files in the right place so that the
computer knows where to find them, the computer can't even boot up.
|nCOMMAND.COM|n is the part of DOS that interprets every command you type in
at the DOS prompt. It also has lots of commands inside of it, and these
are called internal commands. Here is a list of them:
BREAK CLS DEL EXIT LOADHIGH PROMPT SET TYPE
CALL COPY DIR FOR MKDIR REM SHIFT VER
CHCP CTTY ECHO GOTO PATH RENAME TIME VERIFY
CHDIR DATE ERASE IF PAUSE RMDIR TRUENAME VOL
As long as your version of DOS includes these commands, you can enter any
of them at any |nprompt|n, any time, whether you have a PATH variable in your
environment at the moment, or not. (|sGOTO|s, PAUSE, REM, and SHIFT are
batch file commands that have no useful purpose at the command line.)
<page down> for more
COMMAND.COM continued
These are some other commands that can sort of be considered as internal
commands, because the code that tells DOS how to execute them is inside
the IO.SYS file (or the IBMBIO.COM file if you're using PC-DOS), and they
can only be used from within the CONFIG.SYS file, not at the command line
or from a batch file or anything like that:
BREAK COUNTRY DEVICEHIGH DRIVPARM FILES LASTDRIVE SHELL SWITCHAR
BUFFERS DEVIC|1E DO|1S FCBS INSTALL REM STACKS SWITCHES
They're really not referred to as internal commands, though. They're
usually just called |nCONFIG.SYS|n commands. (Yes, BREAK and REM are both
internal commands and |nCONFIG.SYS|n commands. The code that executes them
is in both the IO file and the |nCOMMAND.COM|n file, so they can be executed
from |nCONFIG.SYS|n or the command line or a |nbatch file|n.)
All the rest of the DOS commands are external, and that means that in
order to execute them you have to have the executable file by that name
available to DOS in order for DOS to run the command.
See also SHELL, COMSPEC, and Shelling Out for more information.
The |TPAUSE|T Command
This command is only useful in a batch file. You can put this command
into any |nbatch file|n, and when it executes, when DOS gets to the |nPAUSE|n
line, it will write "Press any key to continue . . ." on your screen, and
it will just sit and wait for you to press a key. If you press <Ctrl-C>
or <Ctrl-Break>, then DOS will allow you to BREAK out of the |nbatch file|n
and go back to the DOS prompt without finishing the rest of the commands
in the |nbatch file|n. Or, when DOS asks you "Terminate batch job (Y/N)?"
you can say N instead, and DOS will continue on with the next command in
the |nbatch file|n after the one that DOS was working on, at the time you
pressed <Ctrl-Break> or <Ctrl-C>, which in this case was the |nPAUSE|n com-
mand. Well if, instead of one of those two keystroke combinations, you
press any other key, then the |nbatch file|n will continue on with what it
was doing.
This is especially useful for three purposes. First, whenever you need
to allow the user a moment to do something like put a different floppy
disk into drive A: or turn the printer on.
<page down> for more
PAUSE continued
Second, whenever you want to be sure to allow the user the opportunity to
BREAK out of the batch file with the <Ctrl-C> keystroke. The <Ctrl-C> or
<Ctrl-Break> keystroke generally allows anyone to break out of a batch
file at any time, more or less, but if you want to be absolutely sure the
user will be able to get out if desired, at a certain point in the batch
file, without a doubt, then put a |nPAUSE|n command into the |nbatch file|n at
that point.
Third, whenever you're working on creating a |nbatch file|n, and you're not
sure you have the exactly correct commands in it, you can remove the |nECHO|n
OFF line from the beginning, if you had it there, and insert |nPAUSE|n com-
mands every two or three lines, so that you can execute the |nbatch file|n
and watch what happens without trying to read the screen so fast as it
scrolls by. You'll have plenty of time to look and see what the batch
file is doing, so you can figure out which parts aren't working right.
You can type whatever you want after the |nPAUSE|n command, on the same line
with it, without affecting anything. If ECHO is on, then the whole com-
<page down> for more
PAUSE continued
mand, including whatever you might have typed after it, will be displayed
on the screen. But if echo is off, only the message "Press any key to
continue . . ." will show up, so you probably want to precede the |nPAUSE|n
command in the batch file with an ECHO command to tell the user what it
is that DOS is pausing to wait for.
You might want to make the computer's speaker beep along with a |nPAUSE|n
command, to alert the user that the computer is waiting for a keystroke,
in case he walked off to do something else while that |nbatch file|n exec-
utes. To put a beep into a |nbatch file|n, you need ASCII character 7, which
is called BEL. To enter an |nASCII|n character 7 you can hold down the <Alt>
key and type a 7 on the numeric keypad. If a ^G appears on your screen,
you know it worked. (Some text editors won't properly accept such input
from the <Alt-number> method.) If you're using EDLIN to create a batch
file, there's another way to do it also. Just type |nECHO|n ^VG where the
^ symbol means to hold down the <Ctrl> key while typing the next letter.
The ^V tells |nEDLIN|n that the next character you enter should be interpret-
ed as a control character, so ^VG puts the |nASCII|n 7 character into the
<page down> for more
PAUSE continued
file. (The next time you list that file to the screen, the V will be
missing, but that's ok; it's served its purpose and the computer knows
now that the G is really supposed to be a <Ctrl-G> or BEL character.)
Now whenever you type that file to the screen with the TYPE command, or
execute it by typing the name of the batch file itself, your computer
will ring its bell (beep its speaker). So just put the |nPAUSE|n command
right after that line, or of course if your |nbatch file|n does not have ECHO
off, you can just place these ASCII 7 or ^G characters on the |nPAUSE|n com-
mand line instead of using a separate |nECHO|n command.
The |TREM|T Command
This command has no use except in the CONFIG.SYS file or in a batch file.
It stands for REMark. All it does is tell DOS to "ignore this line". So
that you can insert little comments into your |nCONFIG.SYS|n and batch files,
to remind you of what a certain command is supposed to accomplish, so you
don't wonder six months from now why you wrote what you did.
Also, if you want to temporarily disable a line from a |nbatch file|n or from
the |nCONFIG.SYS|n file, without removing it permanently, you just insert the
word |nREM|n and a <Space> at the beginning of the line, and DOS will ignore
that line when it executes the file. Of course in a |nbatch file|n, an even
easier way to temporarily disable a line is to just put a colon (:) in
front of it. That way, DOS will think it's just a label for the GOTO
command, so DOS will totally ignore that line as long as there isn't a
|nGOTO|n command in the file that uses a label by the same name as the first
word in the line you're disabling.
If you want the REMark to display on the screen as a |nbatch file|n executes,
<page down> for more
REM continued
you have to have echo on. In fact, if echo is on, |nREM|n is the best way to
display a line on the screen, because the ECHO command will display the
line twice if echo is on.
|nREM|n was not a valid CONFIG.SYS command until DOS version 4, so if you use
it in a |nCONFIG.SYS|n file in an earlier version, you'll get an error mess-
age "Unrecognized command", but it won't hurt anything. It will only
look like something is wrong with your |nCONFIG.SYS|n file as it executes.
As long as there's only the one error message, and you remember that it's
because of the "REMmed out" statement, then you'll be fine.
Which reminds me, I'd better warn you that a lot of people will go around
telling you to "|nREM|n out" a line in a |nCONFIG.SYS|n or batch file, and expect
you to understand what they're talking about. Well what they're talking
about is just putting the word |nREM|n and a <Space> in front of the line in
question, so that DOS will ignore that line the next time the file gets
executed.
The |TGWBASIC|T Command
This is the command which runs the GW-BASIC interpreter. What on earth
does that mean? Well GW-BASIC is Microsoft's specific brand name for
BASIC, which is a very simple (compared to most) programming language.
Now the GW-BASIC version of BASIC does not include a compiler. A compil-
er is what turns some programmer's source code into a .COM or .EXE file.
GW-BASIC doesn't make .COM or .EXE files; it only makes .BAS files, and
those are not executable. So you need the GW-BASIC interpreter to tell
the computer what your source code (the .BAS file) means. Because the
computer can't understand BASIC without the interpreter, until it's been
compiled (converted to a .COM or .EXE file).
To run a program whose filename ends in .BAS, you just type |nGWBASIC|n fol-
lowed by the first name of that program file. For example, if you have a
file named MUSIC.BAS that you would like to run, you type |nGWBASIC|n MUSIC.
And the GW-BASIC interpreter will load into your computer's memory, and
load that MUSIC.BAS file from your disk into |nmemory|n also, and then exec-
ute the instructions that are inside the MUSIC.BAS file. Of course, if
<page down> for more
GWBASIC continued
the MUSIC.BAS file is not in the current directory of your |ncurrent|n drive,
you'll have to tell GW-BASIC where to find it, as in |nGWBASIC|n C:\GW\MUSIC.
If you have PC-DOS rather than MS-DOS, then you want to use the BASICA
command rather than the |nGWBASIC|n command, which you don't have anyway.
It's just the same thing, except for one difference. The BASICA command
won't run on a non-IBM computer, because IBM computers have a part of the
BASIC code stored in ROM, and the BASICA command depends on that code for
its operation. If you try to run this command on a computer that isn't a
true-blue IBM, the code will just sit there all day long looking for that
piece of |nROM|n that has the rest of the BASIC code in it, and you can't do
a thing about it except reboot. So that's why people with clones (compu-
ters that are compatible with IBM but are not manufactured by IBM) are
not supposed to be using PC-DOS. Because PC-DOS doesn't have the |nGWBASIC|n
command, and the BASICA command won't run on a clone.
If you have DOS version 5, you have the QBASIC command instead of BASICA
or |nGWBASIC|n. It's just about the same thing, only better. But the same
<page down> for more
GWBASIC continued
rules apply about trying to use PC-DOS's QBASIC command on a non-IBM com-
puter. It won't work.
If you run |nGWBASIC|n without a filename, it will just load and sit there
showing you its prompt, and waiting for you to tell it what to do. (The
GW-BASIC |nprompt|n is just _, an underline, which is usually preceded by an
OK message.) If you want to get back to DOS just type SYSTEM and hit
<Enter>. Otherwise, go get yourself a nice BASIC book and check it out.
It really is a lot easier than other programming languages.
The name BASIC, by the way, stands for Beginners' All-purpose Symbolic
Instruction Code.
If you have a special proprietary version of DOS, like from the Kaypro
company or the COMPAQ company or the Zenith company, you might have a
command named BASIC instead of |nGWBASIC|n. But it's just the same thing,
only optimized to run best on your specific brand of computer.
The |TRENAME|T Command
This command can be abbreviated as REN. In fact, many people don't even
realize that |nRENAME|n is a valid command; they think that REN is the whole
command, not its abbreviation.
It is used to give a file a different name from the name it has now. The
syntax is really easy.
|nRENAME|n D:\DIR\FILENAME.EXT FILENAME.EXT
Of course if the file is in the current directory of the |ncurrent|n drive,
you can leave out the D:\DIR\ part. But you can't specify a |spath|sname for
the second filename, since you can't rename a file to a different place.
(For that you want the COPY command.)
You could also do something like rename all your .TXT files to have .DOC
extensions, all in one command, like this:
|nRENAME|n FILE*.TXT *.DOC
Notice that wildcards on the target side of the equation have a different
meaning than |nwildcards|n on the source side. FILE*.TXT means "every file
<page down> for more
RENAME continued
that has FILE as the first four letters of its first name, and a .TXT
extension", but *.DOC means "the same first name as the source files but
with the extension .DOC". It won't do a thing to any files you might
already have, with .DOC extensions, or to any files with .TXT extensions
that don't have FILE as the first four letters. On the target side of
the equation, wildcards just tell DOS to leave this part the same as it
was on the source side. So you could say |nRENAME|n |nCONFIG.SYS|n *.BAK to save
typing the word CONFIG twice.
If you try to rename a file to a name that some other file in the same
directory already has, you'll get a "Duplicate filename" error message.
You can't do that. Every file in a |ndirectory|n has to have its own unique
name. Either delete the file that already has that name, or COPY the
source file over top of it, or else choose a different name and try the
|nRENAME|n command again.
If you ever give a file a name with a <Space> in it, like FILE ONE.TXT,
you won't be able to do anything with that file. DOS doesn't allow spac-
<page down> for more
RENAME continued
es in filenames, so it won't let you delete or anything else, with such
an invalid name. But you can use a |nRENAME|n command with wildcards to fix
that problem right up. |nRENAME|n FILE?ONE.TXT FILEONE.TXT will do it, be-
cause the ? wildcard stands for "any character in this position of the
filename" so that will take care of the <Space>. And now the file has a
valid name, so you can do whatever you want with it.
If you have a filename that's so badly garbled (probably because of mag-
netic damage to the directory entry) that the ? wildcard method won't
work, try this one:
|nXCOPY|n |n*.*|n NEWNAME /P
Now the /P switch will cause the XCOPY command to stop and ask you before
it copies each file, so you want to say no to all the files except the
damaged filename. The file with the damaged name will be copied to the
NEWNAME file, and then if you have DOS version 4 or later (don't even try
this if you don't have version 4, because the /P switch didn't exist for
the DEL command before that), you can use the same trick with |nDEL|n |n*.*|n /P
and say no to every file except the funky one. There, now the bad file-
<page down> for more
RENAME continued
name is gone and the file is still there, under the new name. If you
have more than one filename that's damaged like that, you have to start
up the XCOPY command again and this time say something like |nXCOPY|n |n*.*|n
NEWFILE2 /P, because you won't be able to copy any other files to the
NEWNAME filename without overwriting the one you just created by that
same name. You'll have to specify another target filename.
You can rename all your external DOS commands (the ones that have disk
files, that are not stored inside the COMMAND.COM file) to whatever names
you want them to have. You can |nRENAME|n |nFORMAT|n.COM FORM.COM to make it
shorter to type, or you can |nRENAME|n |nRECOVER|n.COM BAD.COM so you remember
that you don't ever want to use that command. But if you do any renaming
of DOS commands, or any other commands, just remember that if any other
program or batch file calls those commands, they won't be able to find
those commands under the new name because they're still looking for the
old command names. (For batch files that's easy to fix; just edit the
file to replace the old command name with the name that you changed it
to.) Another reason this can give you trouble is that if you go over to
<page down> for more
RENAME continued
your friend's house to help him with his computer, and you go to format a
disk and you type FORM A: because that's what you're used to on your com-
puter, well of course your friend's FORMAT command is still named |nFORMAT|n
.COM and your friend might think you're not as smart as you think you are
because you'll get a "|sBad command or filename|s" message.
The |TRECOVER|T Command
This is a command you want to be very careful with. In fact you might
want to remove it from your disk, or RENAME it to DESTROY or something,
so that you don't ever use it accidentally.
What it's supposed to be used for, is to retrieve one file at a time, no
more than one at a time, from a disk that has been damaged. You see,
when DOS finds a file that has a bad spot in it, DOS just won't do any-
thing with any part of the file. Well, the way to get back all the read-
able parts is with the |nRECOVER|n command. The syntax is:
|nRECOVER|n D:\DIR\FILENAME.EXT
and as usual, if the file in question is in the current directory of the
|ncurrent|n drive, you can leave that part out and say |nRECOVER|n FILENAME.EXT.
This will cause DOS to take the readable parts of the file and stick them
into a file with the same name, but in the root |ndirectory|n of the disk in
question. It will also mark the bad sectors as "in use" in the FAT, so
that DOS never tries to stick any more data in that spot. So, now what do
you do with it? Well, if it used to be a .COM or .EXE file, you're going
<page down> for more
RECOVER continued
to delete it. It's got a chunk missing out of the middle, where the bad
sector was, so there's no telling what it might do to your computer if
you try to run it. (But don't just delete it instead of RECOVERing it!
Because if you |nRECOVER|n it first, then the bad sector will be marked as
bad in the FAT so DOS will never try to put a file in that spot again.)
If it was a word processor or spreadsheet file, on the other hand, well,
at least you got most of it back, right? It's better than losing the
whole file. You just have some work to do, to put it back to its prev-
ious shape. (If you kept |sbackup|ss like you're supposed to, you wouldn't
have such problems.)
Note that the |nRECOVER|n command always works with full sectors, so there
will be an exact multiple of 512 bytes missing from wherever the bad sec-
tors were, and then at the end there will probably be a little extra data
stuck on there too, because |nRECOVER|n will take the entire last sector of
the file, even the part of that sector which came after the end of the
file, which would probably be some leftover data from an old file that
you deleted ages ago.
<page down> for more
RECOVER continued
All right, that's fine, it sounds like it will work for just one file at
a time. But if you have a floppy disk that's a total wreck and a whole
bunch of files are giving "Data error reading drive A:" messages, do you
have to use the |nRECOVER|n command on every file separately? Well, it's not
a bad idea. It's a heck of a lot more sensible than RECOVERing the whole
disk. You can't use wildcards with this command; your only choices are
one file at a time, or the whole disk at a time. And RECOVERing a whole
disk at a time is just about the silliest thing you could possibly do,
unless the directory itself is what has the bad sectors.
If you really have a disk with hardly anything but bad sectors, the first
thing you should do is make a DISKCOPY of it and try to |nRECOVER|n the copy,
not the original. That way, if the recovery operation is a big flop, you
can take the original and start over, only this time take it to a friend
who has PC Tools or the Norton Utilities running.
Next, use XCOPY with the /S switch to get all the data you can from that
disk, onto some other disk, then whichever files get copied successfully,
<page down> for more
RECOVER continued
delete those from the damaged disk. And if the copying and deleting emp-
tied any subdirectories on the disk, then RMDIR them. That way there
won't be so many files left on the disk to get mixed up. Now, the only
files left on the disk are the damaged ones, so |nRECOVER|n and then delete
each of the .COM and .EXE files too, because even if you |nRECOVER|n them you
won't be able to use them, for the reason stated above. Now all that's
left is the data files that need to be recovered.
If you have a disk where the directory structure itself is what has the
bad sectors, you won't be able to access any files on the disk at all.
First, make a DISKCOPY of it, and then use the |nRECOVER|n command on the
copy. Or if you have a |nbackup|n copy of the disk, just trash the damaged
one and forget about the |nRECOVER|n command.
To |nRECOVER|n a whole disk, the syntax is |nRECOVER|n D: and that's all there is
to it. All the files on the whole disk, including the subdirectories
themselves, will be RECOVERed and you'll end up with a root |ndirectory|n
full of nothing but FILE####.REC files, because that's what the |nRECOVER|n
<page down> for more
RECOVER continued
command will name them. FILE0001.REC, FILE0002.REC, etc. If there are
too many files to fit in the root directory (remember that there is a lim-
it to the number of entries allowed in any |nroot|n |ndirectory|n), the command
will stop, and you should COPY the .REC files to another disk and delete
them from the damaged disk, and enter the |nRECOVER|n command again so it can
finish the rest of the disk.
If you ever accidentally use the |nRECOVER|n command on a disk when you meant
to use RESTORE instead, or if you just didn't know what horrible things
|nRECOVER|n would do to your files, then do not pass GO, do not collect $200,
just go straight to PC Tools or the Norton Utilities or if you have DOS
version 5, the UNFORMAT command. If it's a floppy disk, make a DISKCOPY
of it first though, in case the Utilities don't work the first time, you
can start over on the copy.
There's one other thing the |nRECOVER|n command is useful for, though. If
you have a |nfloppy|n disk from which you want to ERASE all the files, but
the disk has subdirectories on it, you would have to delete all of the
<page down> for more
RECOVER continued
files from one subdirectory, RMDIR the directory, delete the files from
the next subdirectory, remove it, etc, and then delete all the files in
the root |ndirectory|n. Well there is an easier way, if you're absolutely
positive that you want that whole disk erased. |nRECOVER|n A: will put all
the files into the |nroot|n |ndirectory|n, and convert the subdirectories to
files, and put them in the |nroot|n |ndirectory|n too, so that |nDEL|n A:\*.* will
remove everything from the whole disk. Hey, wouldn't it be easier to
just re|sFORMAT|s the disk? Yes, it would, but this is just an example of
another way to skin a cat.
The |TVER|T Command
This command is super simple to explain, but then again it doesn't do
anything useful, either. It just tells DOS to show you the name and
number of the DOS version you're running. It might look like this:
C:\>VER
MS-DOS Version 5.00
And if you have version 5, there is an undocumented switch, /R. Here
is its output:
C:\>VER /R
MS-DOS Version 5.00
Revision A
DOS is in HMA
And that does mean the version you |sboot|sed the computer with, not just
whatever version is installed on the current drive or anything.
The |TVOL|T Command
This command isn't any more fun than VER. All it does is tell you the
volume label of a disk. Like this:
C:\>VOL C:
Volume in drive C is WHATEVER
Volume Serial Number is 16CB-74E4
You could get the same information and more, from the DIR, CHKDSK, or
LABEL commands.
Of course if you have DOS version 3.3 or earlier, you won't have a ser-
ial number on your disks.
The volume label is stored as an entry in the root directory of the disk,
even though it doesn't take up any disk space. The |nCHKDSK|n command will
count it as a Hidden file, because |nCHKDSK|n doesn't understand the Volume
attributes, so it interprets them as Hidden |nattributes|n instead.
The |TSHARE|T Command
This is a TSR that you need to load every time you boot up, if you are on
a Network or if you are using DOS version 4 and you have one or more hard
drive partitions of a size over 32 mega|sbytes|s. I mean it, if you have any
logical drives that are larger than 32 megs and you are using DOS version
4 then you have got to load |nSHARE|n or really terrible things will happen
to your data. This is not an idle threat. DOS didn't really and truly
learn how to deal with these large drives until version 5, although in
version 4 it became possible to have them that big. |nSHARE|n is the only
thing that makes it safe to have those large partitions under version 4.
It's easy to make |nSHARE|n load itself every time you |nboot|n up. Just make
sure the |nSHARE|n.EXE file is located in the same directory that contains
your COMMAND.COM file, and DOS will load it automatically. Or, if for
some reason that's not working, then put INSTALL=C:\DOS\SHARE.EXE into
your CONFIG.SYS file and that will definitely load it. Of course then
make sure the |nSHARE|n.EXE file is in the C:\DOS |ndirectory|n where you told
|nCONFIG.SYS|n it was at.
<page down> for more
SHARE continued
Now if you have DOS version 4 and a large hard drive partition, and DOS
doesn't find the |nSHARE|n.EXE file in order to load it, it'll give you this
error message: "Warning! |nSHARE|n must be loaded for large media". (Media
just means the type of disks you're using.) You can also use |nSHARE|n from
the AUTOEXEC.BAT file, but if you do, you will still receive that error
message, because that message comes up before the |nAUTOEXEC.BAT|n file gets
read, so DOS will just think that you were planning to skip the loading
of |nSHARE|n. Besides, if something that comes earlier in |nAUTOEXEC.BAT|n than
the |nSHARE|n command, is something that writes to the disk, then you're in
trouble since |nSHARE|n has not been loaded yet. So it's really best to use
one of the other methods to load |nSHARE|n.
Another thing that |nSHARE|n does in version 4, is it checks the serial num-
ber on your floppy disk before it allows anything to be written to it, to
make sure you didn't change |ndisks|n. That way, DOS won't trash the flop-
py's FAT by writing info that was supposed to go on one disk, to another
disk, after you changed |ndisks|n without DOS realizing it.
<page down> for more
SHARE continued
But on the other hand, another thing that |nSHARE|n does is to refuse to let
you do a bunch of things you might want to do. It thinks it's protecting
your hard drive, but sometimes it just gets a little carried away. So
when I first got DOS 4 and an 85 meg hard drive, I only used |nSHARE|n for
about three days before I got fed up and decided to use FDISK to repar-
tition my drive into smaller logical drives, so that I didn't need to use
|nSHARE|n anymore. You might end up doing the same thing. Then again, if
you just get DOS version 5, you can have a partition as large as you want
without needing |nSHARE|n.
The |TSTACKS|T Command
This command can only be used in a CONFIG.SYS file. About the only time
you'll ever want to use this command, is to set it like this to save mem-
ory:
STACKS=0,0
But if you ever get an error message such as "Stack overflow", or if your
system locks up when you type too fast, then you'll want to remove that
command again to make DOS use the default values. (The |ndefault|n for 8088
computers already is 0,0 but for 286 or higher, the |ndefault|n is 9,128.)
If you still get that error message, try a command like STACKS=15,128 or
even 20,512 if necessary. Other than 0,0 the other acceptable values are
anywhere from 8,32 to 64,512.
The first number means number of stacks, and the second means number of
bytes in each stack. 9,128 means 9 and 128, not nine thousand one hun-
dred twenty-eight.
<page down> for more
STACKS continued
So what is this "stacks" stuff anyway? Well every time you hit a key on
the keyboard, that generates a hardware interrupt. Every time a bit of
data comes across your modem, that generates an interrupt. Each time the
floppy disk controller says, "Ok, I'm done writing that file you told me
to write", that's an interrupt. The computer has to have a place to put
what it's working on, so that it can handle the interrupt and go back to
what it was doing before, and that place is what the stacks are.
In case a software program you're using doesn't have enough stack space
built into it, the computer will need for DOS to have some stack space
set up. If a stack overflow occurs, generally that's going to lock up
the computer tighter than a drum, and the only thing you'll be able to
do is reboot. The very next thing you'll want to do is edit your CON-
FIG.|nSYS|n file to allocate some more stack space, and then |nreboot|n again
to make the new CONFIG.SYS file take effect, so it won't happen again.
Because when your computer locks up when you're in the middle of a pro-
gram, you lose whatever changes you might have been making in the file
you were working on.
The |TTRUENAME|T Command
This is an undocumented command, which means two things. First, it means
that it's not mentioned in the manuals. Second, it means that Microsoft
is not promising to keep supporting this feature in later DOS versions.
They might leave it in, or they might not.
Well the command made its first appearance in DOS version 4, and its pur-
pose is, as its name implies, to tell you the actual name of a drive or
directory that is currently being disguised as some different drive or
|ndirectory|n, via the ASSIGN, JOIN, or SUBST commands.
For example, if you have used the |nSUBST|n command to pretend that the dir-
ectory D:\WORD\DOCS is the E: drive, then if you say |nTRUENAME|n E: it will
tell you D:\WORD\DOCS. You can also use this command with no parameters,
and it will tell you the true name of the current drive and |ndirectory|n, or
with a drive and |spath|sname, or with a filename, or whatever.
Just remember that the fact that Microsoft didn't document this new com-
mand could mean that it doesn't always work right.
The |TVERIFY|T Command
This command, with no parameters, tells you whether DOS's write verifica-
tion flag is turned on or off. |nVERIFY|n ON will turn it on, and |nVERIFY|n OFF
will turn it off. Off is the default so if you want to leave it off, you
don't have to do anything with it. About the only time you want to turn
|nVERIFY|n on is when you're making a backup, or when you think your disk is
going bad or something. But remember to disable your disk cache, or else
|nVERIFY|n does no good, because DOS will be verifying the data in the |ncache|n,
and just think that it's the disk that it's verifying.
All it does is to verify that the copy of whatever was just written can
be read from the disk, meaning that it was not written to a bad sector.
It does not in any way compare the data that was written to the data that
was supposed to be written. Other than that, it just makes everything
work a lot slower than normal. The |nVERIFY|n command does the same thing as
the /V switch with the COPY or XCOPY commands, only |nVERIFY|n does it all
the time instead of just when you use the /V switch, if you have |nVERIFY|n
turned on. It's just a lot more sensible to use COMP or FC instead of
|nVERIFY|n, to make sure any important files were properly copied.
What Are |tWildcards|t?
|nWildcards|n are a way to specify a group of files all in one word, so that
you can perform some DOS operation on them all by using just one command.
For example, you can't specify multiple files as parameters to the DEL
command, but what if you want to delete all the files in a |sdirectory|s? Do
you have to delete every single filename separately?
No, you can use |nwildcards|n. You know what |nwildcards|n do in poker, right?
If the dealer says at the beginning of a hand that the J is going to be
a wildcard, and you end up with the hand 10 J Q J A, then you can
say that your J is posing as a K, and you have a royal straight flush!
Well |nwildcards|n in DOS work in a similar manner.
The two |nwildcards|n that can be used are ? and *. The ? stands for "any
character in this position" and the * stands for "any character from this
position through the end of the filename" if the * is in the filename,
or "any character from this position through the end of the extension" if
the * is in the extension.
<page down> for more
Wildcards continued
The wildcard specification |t*.*|t means every file with any number of char-
acters in the filename and any number (including zero) of characters in
the extension (up to the normal limit), in the current directory. (See
the RENAME chapter for some important information about how |nwildcards|n are
used on the target half of a command!) *.EXE would mean every file that
has the .EXE extension. BL*.? means all files whose first name starts
with BL and whose extension is only zero or one character long. BL??.E*
means all files whose first name starts with BL and only have zero, one,
or two characters after that, and whose extension starts with E.
The reason that ? and * can represent zero characters, is that in a dir-
ectory, the bytes of data are always located in the same place. I mean,
the filename always starts in column one, the extension in column nine,
followed by the attributes byte in column twelve, etc. So if a filename
is only five characters long, then columns six through eight are padded
with spaces. Well as far as |nwildcards|n are concerned, a <Space> is sort
of a valid filename character, even though in other cases, DOS does not
allow them at all.
<page down> for more
Wildcards continued
That's why if you ever accidentally give a file a name that has a <Space>
in it, and DOS won't let you do anything with it, you can use a wildcard
specification to rename the file to some legal filename. For example, if
the file was named ABC DEF.TXT, then you could do this:
|nRENAME|n ABC?DEF.TXT ABC-DEF.TXT
because the ? will pick up the <Space> in the filename, and a hyphen (-)
is a valid filename character. Now DOS will let you access that file.
Anyway, one thing you have to remember is that you don't have any control
over how many characters the * wildcard will stand for. If you want to
refer to two files named ABCDE.TXT and ABCE.TXT, you know that AB?E.TXT
won't work because in that first file, there are two characters between
the B and the E, so you might try AB*E.TXT. Well that wildcard spec will
pick up both of those files, but it will also pickup any other files that
start with AB and have the .TXT extension, regardless of whether the last
letter in the filename is an E or not, because * means "any characters
from here to the end of the filename", not just "one or two characters".
DOS will just totally ignore the E in that wildcard filespec.
<page down> for more
Wildcards continued
So, do you want to delete every file in the current |sdirectory|s? |nDEL|n |n*.*|n
will do it. Want to copy all the files in your word processing program
to a floppy in drive B:? If they all start with WP, then |nCOPY|n WP*.* B:
will do that. Most DOS commands use wildcard specifications in place of
exact filenames. |nWildcards|n won't catch Hidden files, though. The wild-
card specification of *.* will catch all the files in the |ncurrent|n dir-
ectory except for the ones with H or S attributes.
One thing that's really important when using |nwildcards|n, especially with
the DEL or ERASE commands: always do a DIR of it first! If you're about
to use |nDEL|n ABC*.?? to delete everything that has a filename that starts
with ABC and an extension of two or fewer characters, then first do |nDIR|n
ABC*.?? to make sure you aren't about to delete something you hadn't in-
tended to delete. Then if the |nDIR|n command doesn't show you any surpris-
es, just type |nDEL|n and <F3> and <Enter>. (See editing keys.) Because the
|nDEL|n will overwrite the |nDIR|n in the template (DOS's |nmemory|n of the last com-
mand line) and then the <F3> key will copy the ABC*.?? from the template
to the |ncurrent|n command line. That way you always know for sure, exactly
which files you are about to delete with a wildcard specification.
The |TREPLACE|T Command
This command is good especially for updating to a new version of a soft-
ware package. With the /U switch, it will take all the files from the
source disk that have the same names, but later dates, than the files on
the target disk. Then you can use it one more time with the /A switch
instead of the /U, to add all the files that are on the source disk that
don't exist on the target disk. Pretty easy, huh?
Here's the complete syntax:
|nREPLACE|n D:\DIR\FILENAME.EXT D:\DIR\ /A /P /R /S /U /W
where the first D:\DIR\ is where the source files are, and the second
D:\DIR\ is where you want the files to go. Here are the switches:
The /A switch makes |nREPLACE|n add the files that exist on the source disk,
that do not exist on the target disk. This is the switch you want to use
after you've already run the |nREPLACE|n command with the /U switch. This is
also the switch you want to use if all you want to do is copy files that
do not exist already on the target disk. Very handy! But it only works
<page down> for more
REPLACE continued
in the specified target directory. In other words, you can't use the /S
switch with the /A switch.
The /P switch makes |nREPLACE|n pause and ask for permission before each file
it copies.
The /R switch makes |nREPLACE|n update even the files that have their Read-
only attributes turned on. Only it doesn't set the R attribute for the
file after it writes it, you have to do that yourself if you want to.
The /S switch causes |nREPLACE|n to search subdirectories of the specified
target |ndirectory|n, for files that need to be updated. It doesn't search
subdirectories of the source |ndirectory|n, though, just the target. Now you
want to be careful with this switch, because there might be a file in one
of the subdirectories, that has the same name as one of the files on the
source disk, but that has no relation to the program you're updating. If
so, that file will be overwritten by the file on the source disk that has
the same name. It's also useful if you have more than one copy of a cer-
<page down> for more
REPLACE continued
tain file on your disk, in different subdirectories, and you receive a
newer copy of that file. If you're sure that all the files on the disk
that have that name, are the same file and you want them all replaced
with the new version, then use the root directory as the target and use
the /S switch.
The /U switch makes |nREPLACE|n work only with files that have a later date
and time on the source disk than the date on the target disk. That means
you won't replace a newer file with an older file. This switch did not
exist until DOS version 4, though.
The /W switch makes |nREPLACE|n stop for a second and let you change disks,
between the time you enter the command and the time it will start looking
for files to copy. That's for if you have the |nREPLACE|n.EXE file on one
disk, and the source files on some other disk of the same size, you put
the disk that contains |nREPLACE|n.EXE into the drive, enter the command with
the /W switch, and it will let you take out the |nREPLACE|n.EXE disk and put
in the source disk instead, and then it will start copying.
<page down> for more
REPLACE continued
So what you usually want to do is run the |nREPLACE|n command once with the
/A switch and once with the /S and /U switches, for each directory on the
source disk that contains files you want to have updated. If the source
files are all in just one |ndirectory|n, then you only need to use those two
commands one time each, to update the whole program.
You're probably wondering what use this command is, when you could just
use the XCOPY command to copy them all with just one command? Well if
the target files are in different directories, like maybe C:\WORD and
C:\WORD\DOCS and C:\WORD\LTRS and C:\WORD\NOTES, and all the source files
are in one |ndirectory|n on the A: drive, for example, then a command like
|nXCOPY|n A:|n*.*|n C:\WORD would put all the files into the C:\WORD |ndirectory|n,
even if some of them belong in some of those subdirectories of the C:\
WORD |ndirectory|n. The |nREPLACE|n command will look to see where you already
have each file, and put the later copy of each file into the right sub-
|ndirectory|n. The only problem is, files that exist on the source disk that
didn't exist on the target disk, will all be put into the same |ndirectory|n
on the target disk, unless you fiddle with the /P switch a lot.
<page down> for more
REPLACE continued
Ok, that's not exactly the only problem. The |nREPLACE|n command, like most
commands, will not copy Hidden files, nor those that have their System
attributes set. But for programs that don't use any of those types of
files, and that don't have their own installation routines, this can be
a very helpful command.
The |TSELECT|T Command
In version 3 of DOS, this command has to do with code page switching.
(See COUNTRY.) The DOS version 4 |nSELECT|n command is the installation pro-
gram which installs DOS 4 onto your hard drive, and since DOS 5 was re-
leased three weeks ago I'm sure no one is going to buy a new copy of the
old version 4, so I won't waste your time on this one.
The |TIF|T Command
This is a batch file command, which almost never has any use at the DOS
prompt. It causes the following command to be executed or ignored, based
on whether or not the |nIF|n statement is true.
There are several types of |nIF|n statements, and each of them can be used
with a |TNOT|T qualifier. Let's take each type separately.
First, there is IF |TEXIST|T. This is used to check on whether or not a cer-
tain filename exists in the current or specified directory. Suppose you
are in the C:\ |ndirectory|n and you do have a file named C:\|nCONFIG.SYS|n, then
the command |nIF|n |nEXIST|n |nCONFIG.SYS|n |nECHO|n YES, in a |nbatch file|n, would cause
the word YES to appear on your screen. The command |nIF|n |nNOT|n |nEXIST|n CONFIG
.|nSYS|n |nECHO|n NO would cause nothing at all to happen, since CONFIG.SYS does
exist.
You can also use this method to determine whether a file exists in some
other |ndirectory|n, by saying |nIF|n |nEXIST|n C:\DOS\MODE.COM |nECHO|n YES.
<page down> for more
IF continued
It is also possible to determine whether a directory exists, even though
you can't say something like |nIF|n |nEXIST|n C:\DOS |nECHO|n YES because that would
cause DOS to look for a file named DOS in the root |ndirectory|n, rather than
looking for a |ndirectory|n named DOS. Here's how it can be done:
|nIF|n |nEXIST|n C:\DOS\NUL |nECHO|n YES
NUL is a sort of an imaginary device that DOS uses, and it does sort of
exist in every |ndirectory|n on your disk. Of course you will not find it in
a |ndirectory|n listing, but it is sort of there as far as DOS is concerned,
so that |nIF|n test will report that the C:\DOS |ndirectory|n does exist, whether
or not there are any files in it.
Next, there is |nIF|n A==B. This is used to check on whether A is equal to B
or not. Notice that you always need to use two equals (=) signs together
and that you shouldn't leave any spaces in the comparison section of the
command.
The only time this is really useful is when either the A or the B is a
replaceable parameter or an environment variable. (See the batch file
<page down> for more
IF continued
section for more information about using environment variables.) Now you
also need to use some sort of a dummy character, in case the variable or
parameter was not supplied. For example, if you had forgotten to set the
ONE variable before executing the following |sbatch file|s command:
|nIF|n %ONE%==YES |nGOTO|n NEXT
then DOS would expand that line to say |nIF|n ==YES |nGOTO|n NEXT because if ONE
was not set, then it is equal to nothing. This line will give you a
major syntax error. But if you had instead said:
|nIF|n !%ONE%==!YES |nGOTO|n NEXT
and you still forgot to |nSET|n ONE=YES before running the |nbatch file|n, then
DOS would expand that line to say |nIF|n !==!YES |nGOTO|n NEXT. Well that may
not have been the result you had intended, but at least it is not an
error message. You can use just about any character you want for the
dummy character, not just the exclamation point that I used in that
example. As long as you put the same character on each side of the ==
signs, it will work.
Another use for the dummy character is with replaceable parameters. To
<page down> for more
IF continued
make sure that the user of the batch file remembers to type a parameter
on the command line, you could do this:
|nIF|n !%1==! |nGOTO|n FORGOT
Because if there was no parameter on the command line, then DOS will
expand that line to say |nIF|n !==! |nGOTO|n FORGOT, and ! does indeed equal !.
Then under the :FORGOT label, you might want to use some ECHO statements
to tell the user how the |nbatch file|n should have been run. (See the GOTO
section for an example.)
Then there is IF |TERRORLEVEL|T. A lot of programs return an |nERRORLEVEL|n to
DOS after they complete whatever function they were supposed to perform,
and that |nERRORLEVEL|n can be used in a |nbatch file|n. For example, the DISK-
|nCOPY|n command returns an |nERRORLEVEL|n of 1, 2, 3, or 4, if the command was
not successful, or an |nERRORLEVEL|n of 0 if it was. Well the |nIF|n |nERRORLEVEL|n
test is positive if the |nERRORLEVEL|n is the same or higher as the one spec-
ified, so a |nbatch file|n like:
<page down> for more
IF continued
|nDISKCOPY|n A: A:
|nIF|n |nNOT|n |nERRORLEVEL|n 1 |nGOTO|n OK
|nECHO|n Something went wrong!
|nGOTO|n END
:OK
|nECHO|n It worked!
:END
will always report "Something went wrong!" if |sDISKCOPY|s's ERRORLEVEL is 1
or higher, or "It worked!" if the |nERRORLEVEL|n is less than 1.
There are quite a few little public domain utilities that can be used in
a batch file to perform some action based on keyboard input. For exam-
ple, a little program from the 2/90 issue of PC/Computing magazine called
ASK.COM (watch out because I've seen other versions of commands named ASK
.COM that didn't work quite the same way), is used like this to retrieve
a Yes or No from the user during execution of a |nbatch file|n:
<page down> for more
IF continued
@ECHO OFF
|nECHO|n Do you want to load your screen saver into memory? (Y/n)
ASK
|nIF|n |nERRORLEVEL|n 1 |nGOTO|n YES
|nGOTO|n NO
:YES
(Command here to load screen saver)
|nGOTO|n END
:NO
(Command here for if screen saver is not loaded)
:END
The ASK.COM program looks to the keyboard to see which key you press. If
it is Y or y, an ERRORLEVEL of 2 is returned. If it is <Enter>, the
|nERRORLEVEL|n is 1. If you press N or n, the |nERRORLEVEL|n is 0. So in the
sample batch file above, if you press Y, y, or <Enter>, an |nERRORLEVEL|n of
1 or higher will be returned, so the |nGOTO|n YES command will be executed.
If you press N or n, the |nERRORLEVEL|n will be 0 which is less than 1, so
the |nGOTO|n YES command will be ignored and the next line, |nGOTO|n NO will be
<page down> for more
IF continued
executed instead.
What if the question were instead in reference to something to which the
answer will more often be No rather than Yes? You would want the default
chosen by the <Enter> key to be No instead. You could do that like this:
@ECHO OFF
|nECHO|n Do you want to run CHKDSK? (y/N)
ASK
|nIF|n |nERRORLEVEL|n 2 |nGOTO|n YES
|nGOTO|n NO
This time, since the |nIF|n |nERRORLEVEL|n command specifies 2, the |nGOTO|n YES com-
mand will only be executed if the Y or y keys are pressed. Anything else
like N, n, or <Enter>, will return an ERRORLEVEL of 1 or 0 which is lower
than 2, so the |nGOTO|n YES command will be ignored and the |nGOTO|n NO command
will be executed instead.
You could also use the ASK.COM program for a purpose that required three
separate options. Like this:
<page down> for more
IF continued
@ECHO OFF
|nECHO|n If you want choice A, press Y or y.
|nECHO|n If you want choice B, press [Enter].
|nECHO|n If you want choice C, press N or n.
ASK
|nIF|n |nERRORLEVEL|n 2 |nGOTO|n YES
|nIF|n |nERRORLEVEL|n 1 |nGOTO|n ENTER
|nGOTO|n NO
Now don't forget to put those ERRORLEVEL statements in the correct order!
Since an |nIF|n |nERRORLEVEL|n statement is true if the |nERRORLEVEL|n is the same or
higher than the one specified, then if you did it like this:
|nIF|n |nERRORLEVEL|n 1 |nGOTO|n ENTER
|nIF|n |nERRORLEVEL|n 2 |nGOTO|n YES
then any time the |nERRORLEVEL|n is 1 or 2, the |nGOTO|n ENTER command will be
executed, and so DOS will never see the |nIF|n |nERRORLEVEL|n 2 command.
Notice that in that batch file, I couldn't use the <Enter> symbol to rep-
resent that key, as I usually do, because DOS interprets the < and > sym-
<page down> for more
IF continued
bols as representing I/O redirection.
Now remember that ASK.COM is not a part of DOS, so you can't use any of
those batch files unless you get that utility. But since DOS did such a
lousy job of making use of its own ERRORLEVEL parameter, I had to use
that third-party utility as an example of what |nERRORLEVEL|n could do.
You can even nest one |nIF|n command inside another, as in:
|nIF|n |nERRORLEVEL|n 2 |nIF|n |nNOT|n |nERRORLEVEL|n 3 |nGOTO|n TWO
Now if the |nERRORLEVEL|n were 1, then the first |nIF|n test would fail, so the
second one would not even be noticed by DOS. But if the |nERRORLEVEL|n were
2, then the first |nIF|n test would pass, and then the second test would also
pass since it includes the NOT qualifier, so the GOTO command would be
executed. And if the |nERRORLEVEL|n were 3 then the first |nIF|n test would pass
but the second one would fail, so the |nGOTO|n command would be ignored.
PLEASE IGNORE THIS PAGE!
|TSET|T|fSIMPLY1|f
|TSHELL|T|fSIMPLY1|f
|t286|t|fSIMPLY1|f
|t8088|t|fSIMPLY1|f
|tANSI.SYS|t|fSIMPLY1|f
|tAUTOEXEC.BAT|t|fSIMPLY1|f
|tAttributes|t|fSIMPLY1|f
|tBACKUP|t|fSIMPLY1|f
|tCHDIR|t|fSIMPLY1|f
|tCHKDSK|t|fSIMPLY1|f
|tCOMSPEC|t|fSIMPLY1|f
|tCPU|t|fSIMPLY1|f
|tCache|t|fSIMPLY1|f
|tDISKCOPY|t|fSIMPLY1|f
|tDirectory|t|fSIMPLY1|f
|tEMS|t|fSIMPLY1|f
|tEnvironment|t|fSIMPLY1|f
|tExpanded|t|fSIMPLY1|f
|tExtended|t|fSIMPLY1|f
|tHIMEM.SYS|t|fSIMPLY1|f
|tHidden files|t|fSIMPLY1|f
|tIBMBIO.COM|t|fSIMPLY1|f
|tIBMDOS.COM|t|fSIMPLY1|f
|tIO.SYS|t|fSIMPLY1|f
|tLIM|t|fSIMPLY1|f
|tMSDOS.SYS|t|fSIMPLY1|f
|tMemory|t|fSIMPLY1|f
|tRAM|t|fSIMPLY1|f
|tRMDIR|t|fSIMPLY1|f
|tROM|t|fSIMPLY1|f
|tXMS|t|fSIMPLY1|f
|tbytes|t|fSIMPLY1|f
|tcurrent|t|fSIMPLY1|f
|tdefault|t|fSIMPLY1|f
|tfragmented|t|fSIMPLY1|f
|tmultitasker|t|fSIMPLY1|f
|tpublic domain|t|fSIMPLY1|f
|troot|t|fSIMPLY1|f
|tupper|t|fSIMPLY1|f
|TEXIT|T|fSIMPLY2|f
|TFORMAT|T|fSIMPLY2|f
|TRESTORE|T|fSIMPLY2|f
|TSYS|T|fSIMPLY2|f
|tASCII|t|fSIMPLY2|f
|tBoo|1t Disk|t|fSIMPLY2|f
|tDisks|t|fSIMPLY2|f
|tEDLIN|t|fSIMPLY2|f
|tExecutable|t|fSIMPLY2|f
|tParameters|t|fSIMPLY2|f
|tPower|t|fSIMPLY2|f
|tRAMdisk|t|fSIMPLY2|f
|tShelling Out|t|fSIMPLY2|f
|tediting keys|t|fSIMPLY2|f
|tfloppy|t|fSIMPLY2|f
|TAPPEND|T|fSIMPLY3|f
|TASSIGN|T|fSIMPLY3|f
|TBREAK|T|fSIMPLY3|f
|TBUFFERS|T|fSIMPLY3|f
|TCALL|T|fSIMPLY3|f
|TCHCP|T|fSIMPLY3|f
|TCLS|T|fSIMPLY3|f
|TCOM1|T|fSIMPLY3|f
|TCOMP|T|fSIMPLY3|f
|TCOPY|T|fSIMPLY3|f
|TCOUNTRY|T|fSIMPLY3|f
|TCTTY|T|fSIMPLY3|f
|TDATE|T|fSIMPLY3|f
|TDEL|T|fSIMPLY3|f
|TDEVICEHIGH|T|fSIMPLY3|f
|TDEVIC|1E|T|fSIMPLY3|f
|TDIR|T|fSIMPLY3|f
|TDISKCOMP|T|fSIMPLY3|f
|TDO|1S|T|fSIMPLY3|f
|TERASE|T|fSIMPLY3|f
|TFOR|T|fSIMPLY3|f
|TLPT1|T|fSIMPLY3|f
|TSHIFT|T|fSIMPLY3|f
|TTIME|T|fSIMPLY3|f
|tBad command or filename|t|fSIMPLY3|f
|tPATH|t|fSIMPLY3|f
|TDOSKEY|T|fSIMPLY4|f
|TDRIVPARM|T|fSIMPLY4|f
|TECHO|T|fSIMPLY4|f
|TEDIT|T|fSIMPLY4|f
|TFASTOPEN|T|fSIMPLY4|f
|TFCBS|T|fSIMPLY4|f
|TFC|T|fSIMPLY4|f
|TFDISK|T|fSIMPLY4|f
|TFILES|T|fSIMPLY4|f
|TGOTO|T|fSIMPLY4|f
|TINSTALL|T|fSIMPLY4|f
|TLABEL|T|fSIMPLY4|f
|TLASTDRIVE|T|fSIMPLY4|f
|TLOADHIGH|T|fSIMPLY4|f
|TMKDIR|T|fSIMPLY4|f
|TPRINT|T|fSIMPLY6|f
|TQBASIC|T|fSIMPLY6|f
|TSUBST|T|fSIMPLY6|f
|TSWITCHAR|T|fSIMPLY6|f
|TSWITCHES|T|fSIMPLY6|f
|TTYPE|T|fSIMPLY6|f
|tCONFIG.SYS|t|fSIMPLY6|f
|tFAT|t|fSIMPLY6|f
|tKeyboard|t|fSIMPLY6|f
|tLogical Drives|t|fSIMPLY6|f
|tRedirection|t|fSIMPLY6|f
|tTSR|t|fSIMPLY6|f
|TXCOPY|T|fSIMPLY2|f
|tBatch File|t|fSIMPLY7|f
|tDevice Driver|t|fSIMPLY3|f
|tPROMPT|t|fSIMPLY6|f
|TNUL|T|fSIMPLY3|f
|tReplaceable|t|fSIMPLY2|f