AUTOEXEC.BAT
The file AUTOEXEC.BAT contains DOS commands that are executed when the
computer starts up. It is essential that the file be stored in the directory
from which the PC boots (usually C:\). It should be noted, however, that the
file need not exist at all.
@ECHO OFF
Prevents commands from being shown on the screen while they are being
executed. The @ at the beginning of the command prevents even the words "Echo
Off" from appearing. Try placing REM at the beginning of the line; that makes
the booting sequence "visible."
PATH C:\BAT;C:\DOS; . . . C:\UTI;
Semicolons separate the different directories. The maximum number of
characters is 127! Type PATH at the DOS prompt to check what your path currently
contains. Many programs want to add one or
more directories to the path during installation. If you agree to this, you
might see a line added with %. This means "add this directory to the path." Edit
the path yourself if you want to include it and then delete the line with %. If
you leave out C:, then the path will only work when you are on drive C, which is
not so clever. For example, you would not be able to carry out an xcopy command
if you are on the A: drive.
REM LH MSCDEX /D:MSCD01 M:20
The mscdex program allows you to use the CD-ROM drive. The name after
/D: must be the same as that given in the driver line in config.sys. It is very
important that this line come before
the line activating smartdrv so smartdrv can act as a read-cache for the
CD-ROM drive. For more information, see smartdrv on page
When smartdrv starts, it checks to see if mscdex is running. If so,
smartdrv
sets a default value read-cache for the CD-ROM drive. If you want to see
how much memory is allocated, then add /V to the line and this figure will be
shown when booting. /M:20 stipulates the number of sector buffers.
C:\..\SMARTDRV.EXE
smartdrive is shown in this example without parameters for starting point and
minimum sizes. SMARTDRV checks for available XMS memory and chooses the sizes
itself, which works fine for most users. To ensure that SMARTDRV is loaded into
upper memory, it is a good idea to place it early in AUTOEXEC.BAT as it takes up
26 KB memory. See SMARTDRV Disk cache Disk cache on p. for more.
MODE CON CP PREP=((850)..
MODE CON CP SEL=437
MODE CON is a setting (a state to be in) for the console. CP is short for
codepage. Prep means prepare. The file EGA.CPI contains the graphics characters
that are displayed on the screen.
I have chosen examples allowing for two codepages, which is only possible if
space has been prepared in memory first (see display.sys). The first line
prepares for the console to use two different codepages. The second line chooses
the codepage that the console is to use, which means in practice how ASCII
values are shown on the screen. MODE CON gives information about the (optionally
chosen) hardware-supported codepage for CON - this depends on the second
parameter in the line with display.sys
the prepared codepage(s) - controlled by
MODE CON CP prepare= ..
the chosen codepage - controlled by
MODE CON CP select=..
If you have only reserved room for one codepage in the line with display.sys,
you can prepare and choose only one codepage, 437 or 850. If you have chosen
two, then in the first line write
..prep ((437 850) ..
See the manual for the difference between the pages; typically it will be
symbols like the copyright sign © and graphic symbols used for drawing boxes.
Keyb.com..keyboard.sys
Must come after mode con cp select. Installs or configures the
keyboard for an English layout. As the second parameter isn't stated, the
codepage chosen with mode con cp select =
is the one selected. If the second parameter is specifically stated, it must be
identical to the one chosen by select. Takes up 7 KB.
Rem LH ..nlsfunc.exe
loads a program, making it possible to change between codepages using the
CHCP command, e.g. CHCP 437 or CHCP 850. Only relevant if you want to be able to
change between two codepages, e.g. 437 and 850 in Great Britain.
REM LH ..DOSKEY.COM
DOSKEY is a handy little program that remembers your most recently used DOS
commands. Use arrow up and arrow down to browse them. Only relevant if you write
many (long) DOS commands. Takes up 4 KB.
LH C:\DOS\SHARE
SHARE.EXE manages which files are "open" so that two programs can't open the
same file. I have tried it with different
programs but not all give a warning, so you can't be sure that all
programs can use it.
It only takes up 6 KB and I recommend it, especially if you are running
Windows. For WinWord 6.0, Microsoft suggests this line:
LH C:\DOS\SHARE /L:500 /F:5100
Where /L:500 gives the number of "locks," defining how many locked files can
be managed at the same time. /F:5100 specifies, in bytes, how much memory should
be used to make sure two
programs cannot use the same file
simultaneously.
set tmp=C:\temp
set temp=C:\temp
forces programs, such as Windows, to use the specified directory for saving
files temporarily. It sometimes occurs that your PC crashes, i.e. stops
responding, and you have to reboot. If this happens, and a
program wasn't closed properly, temporary files may be left behind. They
are easy to find (and delete), especially if they are in this directory.
The file name usually starts with a ~ symbol and often has TMP as extension.
Delete these files regularly from your hard disk but only when you are at the
DOS prompt with no other
programs running.
rem SET TMP=D:\
rem SET TEMP=D:\
If you have installed a RAMdisk in CONFIG.SYS and also want to use it as a
drive (disk), where temporary files can be stored, you can stipulate the RAMdisk
- in this example drive D - as this drive. If the next free drive is another
letter, of course, you must use that letter. During boot, RAMDRIVE.SYS will show
the drive chosen. Remember to enter both lines.
PROMPT $P$G
Almost everyone uses this prompt, which shows you which drive and directory
you are in (with DOS 6 you do not need to insert it; DOS 6 does it for you).
C:\> is called the DOS prompt because the computer shows that it is ready and is
"prompting" you to write something. The PROMPT command can also be used to
redefine keys or give you other screen
colors. The following prompt command
requires that you have installed ANSI.SYS from your CONFIG.SYS file, as
described earlier. If you have, try entering
C:\>PROMPT $e[0;1;37;44m$P$GPROMPT $e[0;1;37;44m$P$G
The square parenthesis can be produced by pressing
Alt+91 (if you don't have it or can't find it on your keyboard). Then
enter CLS. This will give you a blue screen with white letters. If you like this
better, you can enter the above in your AUTOEXEC.BAT file instead of PROMPT
$P$G. The whole screen will be blue when you work in DOS. If you don't like it,
either re-boot or type
PROMPT $e[m$p$g.
Rem ..gmouse.com
I used to have a Genius mouse with the driver C:\UTI\GMOUSE.COM. By removing
rem, I could load GMOUSE.COM into upper memory. Generally, though, I don't use a
mouse in DOS programs as I find the
keyboard faster.
Mouse drivers for DOS programs
are often accompanied by one file with the extension SYS and one with the
extension COM. The SYS file can be loaded in CONFIG.SYS. The COM file can be
loaded in AUTOEXEC.BAT.
Windows has its own mouse drivers for different mice, and they work in
Windows
programs. If you want to use a mouse in
DOS
programs under Windows, you have to
install the mouse driver before you run Windows. To be able to use the mouse in
a DOS window (not a full screen), the driver must be minimum ver. 8.20 from
Microsoft, or compatible. You might need to add this line in system.ini:
[NonWindowsApp]
MouseInDosBox=1
REM ..EMM386.EXE AUTO
Only relevant in DOS 5 if you have installed expanded memory. This parameter
can be specified when EMM386.EXE is loaded as a program, that is to say from a
DOS command. It does not work in CONFIG.SYS. Auto means that the amount of KB
set aside as EMS memory in CONFIG.SYS is only used as such if a program asks for
it, otherwise it is used as extended memory. But once used as XMS, it won't
return to EMS; it doesn't switch back automatically.
rem WIN :
Many people use the last line to start a
program up, typically a menu or Windows. Here "Win space colon" - skips
the advertizement as Windows starts.
set winpmt=Type EXIT and press ENTER to return to Windows$_$_$p$g
is a good idea, and should be written on one line. Winpmt is short for
Windows' prompt, and this line means that when in a DOS box you will be reminded
that you are running a DOS box in Windows (if you forget and reboot from your
DOS box, it can have unfortunate consequences).
$_$_ has the effect of entering two blank lines (Enter, Enter)
Codepages
(A) Advanced. This relates only to DOS codepages. Windows has its own
codepage, which is defined in Windows Setup.
I have spent a long time experimenting, reading the manual, writing chcp,
keyb and mode con during boot and in several different places in AUTOEXEC.BAT.
On different PCs, I have seen many different versions of the relevant lines
in the startup files. Few people seem to have problems, even if there is a
difference between the active cp (type chcp) and the codepage for the console
(type mode con) - but some do, especially during Windows setup, if they do
not give other parameters in the country command.
It doesn't help matters at all (and here I criticize Microsoft) that
information is not given to every country about codepages in its own language.
First, the DOS 5 manual and the screen messages returned by the above
commands (those that have anything to do with cp) are the most inconsistent
(both literally and in the information they provide) that I have seen for a long
time. The DOS 6 manual is better but not where it is important.
It would appear that Microsoft has chosen chcp to be the "king" of all
commands because at one stroke it can change all cp definitions for
all devices. My experience is that using the second parameter in the country
command is just as good.
It is utterly ridiculous that you have to insert several complicated lines in
a certain order in the startup files simply to define a codepage or to be able
to swap between two. I have given up trying to get an explanation from Microsoft
for why they have made the whole thing so complicated.
As I have already mentioned, a potential problem does exist if you don't
stipulate the second parameter in the country command in CONFIG.SYS, which is
why I mention it here.
I know this is of little practical significance for most readers but maybe
with more international data communication in the future, it will become more
important.
|