Section 1A - Item 13 - DOS System Startup Files

    Return to PC Info Sub-Index Page        Return to Home Page

   
Subject: DOS Start-up Files             Updated: 12-95 RB


                                                        1                 2                         4
Necessary DOS system files (3) - IO.SYS, MSDOS.SYS, COMMAND.COM

                                                                    3
CONFIG.SYS - Is run third (before COMMAND.COM) and configures the PC for your
device drivers and memory allocation for BUFFERS and FILES.
            5
AUTOEXEC.BAT - Runs just before control is given to the user, and tells
the PC how YOU want it set up, and loads "TSR" (Terminate and
Stay Resident or RAM resident programs) and any other programs
you might want such as a menu. 

CONFIG.SYS sets up the PC environment and AUTOEXEC.BAT sets up the USER
environment. 
_______________________________________________________________________________
Typical CONFIG.SYS file (DOS 6.2) - See below for explanations
~~~~~~~~~~~~~~~~~~~~~~~~~~
Line #             Command
~~~~~~         ~~~~~~~~~
1 DEVICE = C:\DOS\HIMEM.SYS /TESTMEM:OFF
2 DEVICE = C:\DOS\EMM386.EXE NOEMS 7104 D=64 X=D000-D3FF
3 BUFFERS = 30 
4 FILES = 35 
5 DOS = HIGH,UMB 
6 rem DOS = HIGH causes AutoCAD to Hang 
7 LASTDRIVE = X 
8 DEVICEHIGH = C:\DOS\ANSI.SYS 
9 DEVICEHIGH = C:\DOS\RAMDRIVE.SYS 7104 512 256/E 
10 DEVICEHIGH = C:\DOS\SETVER.EXE 
11 DEVICEHIGH = c:\proaudio\mvsound.sys d:3 q:11 s:1,220,1,5 m:0 j:0 
12 DEVICEHIGH = c:\proaudio\tslcdr.sys /d:tosh-cd /w3 /p:3 /r
13 BREAK = ON 
14 DEVICEHIGH = C:\WINDOWS\IFSHLP.SYS
15 SHELL = C:\COMMAND.COM /E:512 /P /F
16 STACKS = 9,256


The following explanations are rather generic. Additional info on any DOS
command can be obtained by just typing HELP <COMMAND>.

General Notes: You might notice that there are commands that are longer
than 8 characters. This is OK at this point in the start up routine, for the 
same reason that the commands are non-executables (.com .exe .bat), and that
is because COMMAND.COM which is the DOS interpreter has not been loaded. 
Prior to DOS 6.X, the keyboard was also completely dead during this time, but
with DOS 6 a special routine was included to allow the monitoring of a few 
special keys such as F5 and F8.

It is important to remember that CONFIG.SYS sets up the PC or Machine
environment. This information is required to make all your software programs
interface and work properly with your hardware.


I will indicate whether a command is internal or external. It is good to 
know this for trouble-shooting purposes. External commands means it resides
outside of the three system files. Internal commands mean that they are
part of the system files. Commands such as DEVICE, DEVICEHIGH, SHELL, STACKS,
BUFFERS, and FILES, are all examples of internal commands. If you do a 
directory of the C:\DOS> you will get a listing of all the external commands.

Let's see what we've got:

1. DEVICE = C:\DOS\HIMEM.SYS /TESTMEM:OFF (External command) - This loads 
a device driver that tells the system that there is memory above 640K.

SWITCHES: /TESTMEM:OFF - This handy switch will cause DOS not to test
the extended memory, which can greatly speed
up boot up time during trouble-shooting.

2. DEVICE = C:\DOS\EMM386.EXE NOEMS 7104 D=64 X=D000-D3FF (External command)
This statement tells the system how the memory is to be used, ie.. Extended,
Expanded, included, excluded, and so forth. Of all commands this is the most
mis-understood and sometimes confusing DOS command, and can make or break your
day. You might also notice the first two commands are only DEVICE and not
DEVICEHIGH. This is because until you load these two, you can not load 
anything in high memory (above 640K on older PCs, above 1M on newer PCs)

SWITCHES: NOEMS - Prevents memory from being configured as Expanded (paging)
7104 - Represents the maximum amount of NOEMS, although there
are no hard rules for using this, it lets some programs
run that otherwise tend to crash
D64 - Sometime added by Windows setup. Sets aside 64K of memory
as DMA buffering (Direct Memory Access)
X=D000-D3FF - Prevents DOS from loading data into this area of
upper memory. Some cards such as the SMC LAN card require
a small area of memory to load their drivers, and this will
protect this area for these needs. Run MSD for a good
picture of what is going on here.

3. BUFFERS = 30 (Internal command) Sets aside memory buffers for disk
read and write purposes.

4. FILES = 35 (Internal command) Sets aside memory pointers to keep track
of open files. Ever work in dBASE for a long time and finally the PC locks
up? Probably cause it ran out of FILES, just up the number.

5. DOS = HIGH,UMB (Internal command) - Can be one or two separate 
statements. Tells DOS to load it's own files high and to use upper memory
blocks (another whole discussion). Some systems can not handle one of the 
two commands, and sometimes both. An example, using DOS=HIGH will cause
Release 8 of AutoCAD to hang every time.

6. rem DOS = HIGH causes AutoCAD to Hang (non-command) "REM" is an internal
command to COMMAND.COM which as of this time has not loaded. But we can 
still use it to make comments. You might see a comment scroll up the screen
that says "Bad Command or File Name". Basically it is just ignored. 

7. LASTDRIVE = X (Internal command) - DOS defaults to E if there is no
lastdrive statement. You use a lastdrive statement to give you more drives
if you use SUBSTitute drives, and some LAN cards require you to use
LASTDRIVE=Z.


8. DEVICEHIGH = C:\DOS\ANSI.SYS (External command) - Color screen driver.
It allows you to have a colored prompt. If all you ever run is Windows 
there is no need to load this driver.

9. DEVICEHIGH = C:\DOS\RAMDRIVE.SYS 7104 512 256/E (External command)
This is an optional command, and like number 8 if all you run is Windows
never load this. This will create a RAM or Virtual drive (acts like another
hard drive) that is 7 megs in size, where the sectors are 512 bytes, and 
allows 256 files in the root directory, and it will use Extended Memory.

10. DEVICEHIGH = C:\DOS\SETVER.EXE (External command) - Tells DOS to use 
an external table (editable) to return DOS Version values. Many programs
query DOS when they load to determine what DOS version you are running so 
they know how to run properly. If you type SETVER at the DOS Prompt you will 
see a list of the programs and the value they return. If a program is not on
the list then the current version is returned.

11. DEVICEHIGH = c:\proaudio\mvsound.sys d:3 q:11 s:1,220,1,5 m:0 j:0 

Sound Card Driver         [Default Values]

DEVICEHIGH =c:\proaudio\mvsound.sys d:3 q:11 s:1,220,1,5 m:0 j:0 
             DMA Channel (0,1,3,5,6,7) [3] ...... 
             IRQ (2,3,5,7,10,11,12,15) [7] ...............
           s:
            1 = Sound Blaster [1,220,1,5] .......... 
            220 = Sound Blaster Base Port (210,220,230,240,260)
            1 = DMA for Sound Blaster Audio (1)
            5 = Sound Blaster IRQ (2,3,5,7) (per Sound Blaster Manual) 
            m:0    MPU401 (MIDI) is off
            j:0 Joy Stick    1=Enabled, 0=Diabled 

12. DEVICEHIGH = c:\proaudio\tslcdr.sys /d:tosh-cd /w3 /p:3 /r
(External NON-DOS command) Driver provided by Sound Card Manufacturer.
This command sets up the Interface to the CD-ROM Drive. Below is an 
example of how these are set up.

CD-ROM Driver (SCSI)

DEVICEHIGH =c:\proaudio\tslcdr.sys /d:tosh-cd /w3 /p:3 /r
            Device Name - Must match ............
                            AUTOEXEC.BAT name [mvcd001] 
            /w3   Warning Pause w3=no     stop w1=stop if found      w2=stop if not found
            /p:3   Enables seek commands (Optional) 
            /r      Reset on bootup 

NOTE: If you also use a RAMDRIVE, beware that where you place these
statements will determine the sequence of drive letters.

13. BREAK = ON (Internal command) - Allows CONTROL+C to stop some
software programs.

14. DEVICEHIGH = C:\WINDOWS\IFSHLP.SYS (External NON-DOS command) - 
This is a Windows for Workgroups file system driver.

15. SHELL = C:\COMMAND.COM /E:512 /P /F (Internal command) A Shell is
an interface to DOS. Programs that let you run DOS commands such as
Norton Commander, Wonder Plus, or any of the Xtree programs are Shells.
In this case we are telling DOS to keep using it's own interpreter, but
to use some new parameters.

SWITCHES: /E:512 - Normally the environment size defaults to 128 bytes,
but if you use a long path or prompt statement you
need to increase the environment.
    /P - This tells DOS to boot with AUTOEXEC.BAT
    /F - This is an undocumented switch. It tells DOS to FAIL when it reads an empty floppy drive.

16. STACKS = 9,256 (Internal command) This sets up 9 stacks of 256 bytes
each. The stacks are used to handle hardware interrupts.

===============================================================
Typical AUTOEXEC.BAT file (DOS 6.2)

Line # Command
~~~~~~ ~~~~~~~~~
1 VSHIELD /chkhi /lock /m /copy
2 LH c:\dos\mscdex.exe /d:tosh-cd /m:10 /v /l:f
3 set blaster=A220 D1 I5 T3
4 C:\DOS\SMARTDRV.EXE C D
5 PATH = C:\;C:\DOS;C:\WINDOWS
6 SET TEMP=C:\WINDOWS\TEMP
7 LH C:\DOS\DOSKEY
8 LH C:\MOUSE\MOUSE
9 SUBST T: C:\WORDPROC\DOCS
10 VERIFY ON
11 C:\DOS\MODE COM1:9600,N,8,1,P
12 C:\DOS\MODE LPT1:=COM1
13 SETUP1 LASERIII
14 call c:\dos\setd
15 cd\net
16 call net
17 cd\
18 PROMPT =$e[s$e[1;59H$e[1;33;44m $t$h$h$h$h$h$h $d$e[32;1m$e[u$p$g$e[44;37m
19 CHOICE /T:Y,5 Start WINDOWS 
20 if errorlevel 2 goto nope
21 C:\WINDOWS\WIN
22 :nope
23 CD\
24 cls

                                        AUTOEXEC.BAT file notes: 

It is important to remember that AUTOEXEC.BAT sets up the USER environment. 
This lets you 'customize' the operation to your taste. With a little effort
you can tune it up just the way you want it.

I will indicate whether a command is internal or external. It is good to 
know this for trouble-shooting purposes. External commands means it resides
outside of the three system files. Internal commands mean that they are
part of the system files. Commands such as DIR, VER, SET, ECHO, CLS, DATE,
TIME, CD, MD, and RD, are all examples of internal commands. If you do a 
directory of the C:\DOS> you will get a listing of all the external commands.

PAUSE - Another internal command can be inserted anywhere, usually at the
the very beginning or near the end of Autoexec.bat. This will stop the 
system and let you read what the system is telling you is happening. A 
useful diagnostic tool (won't work in the CONFIG.SYS file as COMMAND.COM 
has not yet been loaded!)

Let's see what we've got:

1. VSHIELD /chkhi /lock /m /copy (External NON-DOS command) This is
a virus scanning/checking program. If you are going to run one it is
a good idea to make it the first thing in the AUTOEXEC.BAT because if
you have a virus you need to find it before you load any programs. Most
scanning programs have switches, as an example these do the following:

vshield /chkhi /lock /m /copy /lh /swap /remove /contact "Help desk x6512"

You can use all or just one of the above parameters. 

/chkhi = Will check 1 meg of mem (1024) plus the 64k upper memory block
checking a total of 1088k. You will receive an error message if
the PC only has 640k of total memory and /chkhi is used.

/lock = If a virus is detected, the PC will display the virus message
and lock the unit from and further i/o or memory activity.

/m = Will check for all known viruses instead of just critical and
stealth viruses.

/copy = This will check .exe and .com files for viruses during copy
operations.

/lh = Can only be used with DOS 5.0. Will load Vshield in UMB area.

/swap = If you are tight on conventional memory you can use /swap to
load a very small Vshield kernel in memory. It will swap in
and out of memory as needed. NOTE: this will slow down the
scan process because of the overhead caused by the swapping.

/contact = Use this parameter if upon virus detection you want a custom
message to display in place of the regular message.

/remove = Removes VSHIELD altogether.

2. LH c:\dos\mscdex.exe /d:tosh-cd /m:10 /v /l:f (External command)
MSCDEX.EXE is a DOS file, but don't be surprised to see your install program
load one in a different directory. Most sound card manufacturers like to
write there own. I believe MSCDEX stands for MicroSoft CD Exchange. At
any rate, this is the driver that lets programs have sound. If you have 
CD-ROM drive, load this BEFORE Smartdrv so that Smartdrv can work with
the CD-ROM drive.

LH c:\dos\mscdex.exe /d:tosh-cd /m:10 /v /l:f
Device Name - Must match CONFIG.SYS name 
        m: = Memory Buffers 
        /v =  On Screen Memory Usage Info 
        /l: =  DOS Drive Letter 

3. set blaster=A220 D1 I5 T3 (External NON-DOS command)
The set command is not a program, and doesn't take up any extra memory, 
it is just a pointer. It tells the Sound Blaster sound driver what the 
interface parameters are for talking to the sound card.

NOTE: For all SET commands, do not put spaces on either side of the "="!

set blaster=A220 D1 I5 T3 (must be D1 I5 to have Wolfenstien work!)

                                        Card Type 3=Pro Audio, 6=SB16 MCD
                                   IRQ 5 [5] 
                               DMA # [1] 
                    I/O Port 220h [220] 

4. C:\DOS\SMARTDRV.EXE C D (External command) This is a disk-caching
program (speeds up repeat accesses of the hard drive). If you do not use
the "C D" switches (for C: and D: drives) this program defaults to read-write
disk cache. If you are the kind of person that might turn your computer
off right after you exit a program, you should turn the 'write' portion of
the cache off. Information can be held in buffer for as long as 30 seconds 
or more before they write the new data to the hard drive. Turning off your
PC before all data is written will result in a loss of data. To see how
it is configured, enter SMARTDRV at the DOS prompt.

5. PATH = C:\;C:\DOS;C:\WINDOWS (Internal command)
PATH Statement. This is a very mis-understood variable. It is not
necessary to list all your sub-directories, only those that contain files
you want to be able to call from anywhere. This is the search order the
operating system uses when looking for a file. If your menu program
indicates what sub-directory the program file is in, then it does not
have to be listed in the PATH statement.

6. SET TEMP=C:\WINDOWS\TEMP (Internal command) The set command is not
a program, and doesn't take up any extra memory, it is just a pointer. It 
points to where DOS is to store temporary data. It is important to have
a temp directory, you could even say SET TEMP=C:\DOS, but then it is more
difficult to clean out unused temp files. SET is also used at the DOS
prompt to display the system environment, this includes the PATH, PROMPT 
statement, where the shell can be found and any SET statements.

Knowing where the shell is an important point we should discuss. When you
load a program, the contents of COMMAND.COM gets erased and over-written.
All programs contain their own programming for controlling the keyboard. DOS
was set up this way in the beginning when there was a very limited amount of
memory (64 or 128K) so that more memory would be available for the program.
When you exit a program DOS goes to the system environment to look to see
where the shell is and what it is called. You can prove this by booting 
off a floppy, start a program, remove the floppy, and then exiting the
program. DOS will crash with an error code saying something like system
halted, no command interpreter.

A related command is SET COMSPEC=x:/COMMAND.COM. This is handy if have an
older PC. You can make a RAM Drive, copy COMMAND.COM to it, and point to it 
with the comspec command. RAM drives are much faster than the old hard drives,
therefore COMMAND.COM gets loaded faster and the PC response will be improved.

NOTE: For all SET commands, do not put spaces on either side of the "="!

7. LH C:\DOS\DOSKEY (External command) DOSKEY is an optional but very
functional background program that keeps a record of your command line
keystrokes which can be recalled with the up/down cursor keys.

8. LH C:\MOUSE\MOUSE (External NON-DOS command) This is the driver for
your mouse. Some mouse drivers will not allow themselves to be loaded
high, and when you run MEM /C /P it will show up in conventual memory.

9. SUBST T: C:\WORDPROC\DOCS (External command) Do not use this if you
run Windows. But if you use DOS this is a great little program. What this
does is save you lots of keystrokes. Instead of typing "CD\WORDPROC\DOCS",
all you have to type is "T:". It has Substituted the drive letter T for
the directory C:\WORDPROC\DOC.

10. VERIFY ON (Internal command) Verify verifies when you copy a
file that the CRC checksum on the copied file/s compares with the original
file/s. It used to be used a lot on early hard drives but isn't used much
with today's highly reliable hard drives.

11. C:\DOS\MODE COM1:9600,N,8,1,P (External command)
12. C:\DOS\MODE LPT1:=COM1 (External command)
The MODE command has many functions. Basically it tells DOS that the rules
have changed some how. These two lines re-direct the printer output from
LPT1, the default, to COM1. The first statement tells the port to operate
at 9600 baud, no parity, 8 bits, one stop bit, and it is a printer port.
The second statement tells DOS to send any data intended for LPT1 to COM1.
Use this when you have a printer that only has a serial connection.

13. SETUP1 LASERIII (External NON-DOS command) This is an example of a 
TSR (Terminate and Stay Resident) or RAM-Resident program. This program
will pop up a small menu to control a printer when you hit the Control and
left-Shift keys together. These programs work by stealing clock cycles
and going out to look for a special key combination that will cause the 
program to activate. This particular TSR works well and has never 
interfered with the operation of the PC or slowed it down. A poorly-
written TSR can slow down a PC and create havoc. How do you know which
are good ones and which to avoid? Try them and find out. Not very
scientific, but it works.

14. CALL C:\DOS\SETD (Internal command) The Call command showed up
in version 4 or 5 of DOS. It calls another BATch file. This means it
causes DOS to run another BAT file, and then RETURN to this BAT file.
If the statement was just C:\DOS\SETD, then DOS would run this new file
and stop. The rest of AUTOEXEC.BAT would never get run. What is SETD?
SETD runs the SET commands to change the variables in the DIR replacement
program "D". This is what is in SETD.BAT:

SET DIRDEF=4
SET DIRCOLOR=GCRMwYBYrwWyRWW
SET DIREXTS=BAK,INI,WAV,BMP,SYS,DOC

15. CD\NET (Internal command) Change Directory to the NET sub-directory.

16. CALL NET (Internal command) See number 14 for a explanation of the
Call command. NET.BAT loads the drivers to let the NIC (Network Interface
Card) talk to the LAN (Local Area Network). It Looks like:

lh lsl
lh smc8000
lh ipxodi
lh netx
F:
login fsp37/username
capture local=1 queue=server  nb nt nff timeout=20

17. CD\ (Internal command) Change Directory back to the root C:\

18. PROMPT =$e[s$e[1;59H$e[1;33;44m $t$h$h$h$h$h$h $d$e[32;1m$e[u$p$g$e[44;37m
(Internal command) (First part of explanation for DOS prior to Ver 6.x)
PROMPT Statement. If you don't make a PROMPT statement, you will just get
the letter of the drive you are in, such as "C>" even if you are in a
sub-directory. If you use "$p$g", Then it will also show you the sub-
directory, as in "C:\DOS>". This problem was solved in DOS 6. It 
automatically defaults to showing the sub-directory. 

If you would like your PROMPT to be in color, use "PROMPT = $e[1;32m$p$g$e[m".
Or if you'd like a blue background with white lettering, use
"PROMPT = $e[32;1m$p$g$e[44;37m".

For the color to work, you must load ANSI.SYS in the CONFIG.SYS file. If
not the PROMPT for the last example will look like .......
"$e[32;1m$p$g$e[44;37mC:\DOS>"

If you are using a PC without a PROMPT statement and you want to know
where you are, just enter "cd\", and DOS will tell you where you are.

The prompt statement listed in the AUTOEXEC.BAT file shown above is not
only in color, but displays the date and time in the upper right hand
corner. If you use a long prompt or path statement be sure to increase
the environment size with the SHELL command in your CONFIG.SYS file.

The prompt statement should come AFTER logging into the network, as most
networks tend to tromp all over your environment and change the prompt and
path statements. As you might guess, you might want to put the path
statement here too, except that you might need the mapping the network
adds to your path statement. So this is something you can play with.

19. CHOICE /T:Y,5 Start WINDOWS (External command) The CHOICE command 
is a wonderful addition to DOS 6. It allows you to pause the execution of
a BATch file to let the user make a decision on what to do. In this case
all that shows up on the screen is: Start WINDOWS? (Y,N). It will wait
for 5 seconds and the default to yes. I like to insert this into 
AUTOEXEC.BAT files so that if you are working on a booting problem you
don't have to keep letting Windows start up just to close it.

When the user hits Y or N, DOS generates and "errorlevel code" (not to
be confused with a error code). This errorlevel, 1 for yes, 2 for no,
is used to control what happens next. Errorlevels are always tested
or listed in reverse order to work properly (has to do priorities).

20. if errorlevel 2 goto nope (Internal command) This statement tested
for an "N" response. If it saw one it says to "GOTO" a label called
":nope".

21. C:\WINDOWS\WIN (External NON-DOS command) If the response was
anything but "N", then the above statement (#20) was ignored the response 
and control was passed to this next statement. This obviously will start
Windows. When Windows ends control will be returned to the next step.

22. :nope (Internal command) This is a label (:) which is the place
that a GOTO command ends up at. So looking at step 20, if the response
was a "N", the control would bypass step 21 and jump here, bypassing
the command to start Windows.

23. CD\ (Internal command) This Change Directory is here so that if
Windows was run, when you exit it will return you to the root.

24. cls (Internal command) This cls (Clear Screen) not only clears
the screen, but will activate your color prompt if you used the one that
shows the date and time.

Summary - As you can see, there are a lot of varibles you can use. The
most important thing to remember is that CONFIG.SYS sets up the PC for
hardware configuration with the memory and other device drivers. And
AUTOEXEC.BAT sets up the user environment, or how the PC looks and feels
to the user. Keeping this in mind and how your system reacts to the
memory calls will help you in your efforts to fine tune your PC.

Good Luck!

    Return to PC Info Sub-Index Page        Return to Home Page