Michael Maardt: PC since 1984 • on the net since 1990.

Get the most out of your PCconfig.sys and autoexec.bat

The startup files config.sys and autoexec.bat configure the PC in a certain way, depending on their contents. DOS 5 and 6 are basically identical as far as these files are concerned. I have chosen to concentrate on DOS 5 with some references to DOS 6, which has a section of its own at the end. You should only consider these examples as suggestions. These files must be in the root directory on the boot drive, typically C:\.

When you install programs, they often suggest making changes to the startup files, so it is nice to know something about what the different lines in these files mean.

CONFIG.SYS will typically contain calls for device drivers, programs that handle devices. AUTOEXEC.BAT contains DOS commands that are automatically run every time the computer is booted. They are DOS commands, though most of them are a little special, so they could just as well have been run from the DOS prompt.

In both startup files, if REM or rem followed by a space is at the beginning of a line, the line is considered a remark and not a command and is therefore not executed.

There is no difference between something entered in capital or lowercase letters. Remember to have a working boot diskette handy before beginning to make changes in CONFIG.SYS. I have chosen examples with two codepages but the commentary describes what to do if you only want one codepage. Codepage is a strange term that describes a collection (a set) of 256 different characters that you see on the screen. Each codepage has a number.

The important files

HIMEM, EMM386, SMARTDRV, RAMDRIVE and MEM are vital files (given here without their extensions) for the operation of DOS 5, Win 3.1, DOS 6 and Win 3.11. The release dates of these versions of DOS and Windows are given deliberately, and the text deals with these files in chronological order. SMARTDRV is an exception. This disk cache program has been much modified and so it has its own special section.

DOS 5

HIMEM.SYS, EMM386.EXE, SMARTDRV.SYS and MEM.EXE. All these files are usually placed in C:\DOS. It is important here that SMARTDRV.SYS only functions as a device driver and can only be installed from CONFIG.SYS. This was SMARTDRV version 3.

Win 3.1

Included an improved version (4.0) of SMARTDRV in the form of an executable EXE file (SMARTDRV.EXE). It could now be run from AUTOEXEC.BAT. Win 3.1 also introduced a fine program, MSD.EXE, which can look at the first MB of memory. All these files are usually placed in C:\WINDOWS.

DOS 6.0

Had the same vital files as Win 3.1, but EMM386.EXE and SMARTDRV.EXE were significantly improved. All files are, once again, placed in C:\DOS.

So watch out if you install Win 3.1 after installing DOS 6 and at the same time accept the Windows 3.1 Setup option to change your AUTOEXEC.BAT automatically. If you do this, you won't be using the new versions from DOS 6. In this case, you should edit your startup files in such a way, that EMM386.EXE etc. are read from C:\DOS and not from C:\WINDOWS

DOS 6.2

The only change was SMARTDRV.EXE ver. 5.0.

Win 3.11 (Windows for Workgroups)

arrived with the same files as DOS 6.2. Specify the latest versions of these important files in your startup files. When you have done that, delete the old ones. This not only saves disk space but also avoids confusion. In the examples, I have used ".." (two dots) for the relevant directory and not "[path]," as is normally written.

I recommend that you read right through the relevant commentary on CONFIG.SYS before you begin to change things.


DOS 5 - SMARTDRV.SYS

CONFIG.SYS

device=\..\himem.sys

dos=high

device=\DOS\emm386.exe noems

dos=umb

devicehigh=\DOS\smartdrv.sys 512 256

devicehigh=\DOS\display.sys con=(,,1)

rem devicehigh=\UTI\gmouse.sys

devicehigh=\DOS\ansi.sys

rem devicehigh=\DOS\setver.exe

country=044,437,\DOS\country.sys

files=30

rem fcbs=1

buffers=5

rem stacks=9,256

break=on

rem shell=\DOS\command.com \DOS /p /f /e:1024

 

AUTOEXEC.BAT

@echo off

path C:\BAT;C:\DOS;....

mode con cp prep=((437) \DOS\ega.cpi)

mode con cp sel=437

LH keyb.com uk,,\DOS\keyboard.sys

rem LH \DOS\doskey.com

LH \DOS\share.exe

rem LH \UTI\gmouse.com

set temp=C:\temp

prompt $p$g

rem \DOS\emm386.exe auto

 


Windows 3.1 or DOS 6 - SMARTDRV.EXE

CONFIG.SYS

device=\..\himem.sys

dos=high

device=\..\emm386.exe noems

dos=umb

rem devicehigh=\..\cdmke.sys /d:mscd01

rem devicehigh=\..\ramdrive.sys 2048 /e

devicehigh=\DOS\display.sys con=(,,1)

rem devicehigh=\UTI\gmouse.sys

devicehigh=\DOS\ansi.sys

rem devicehigh=\DOS\setver.exe

rem device=\..\smartdrv.exe /double_buffer

country=044,437,\DOS\country.sys

files=30

rem fcbs=1

buffers=5

rem stacks=9,256

break=on

rem shell=\DOS\command.com \DOS /p /f /e:1024

 

AUTOEXEC.BAT

@echo off

path C:\BAT;C:\DOS;C:\WINDOWS;C:\UTI;..

rem LH MSCDEX /D:MSCD01 /M:20

\..\smartdrv.exe

mode con cp prep=((437) \DOS\ega.cpi)

mode con cp sel=437

LH \DOS\keyb.com uk,,\DOS\keyboard.sys

rem LH \DOS\doskey.com

rem LH \UTI\gmouse.com

LH \DOS\share.exe

set temp=C:\temp

set tmp=C:\temp

prompt $p$g

rem win :

 

Conventions

These startup files are primarily for standalone PCs, which are not connected to a network. I have no experience with networks, where special drivers may affect memory or other devices.

For typographical reasons, long lines in the following explanations are shortened. Lines that start with REM show options that you may not need, but are included to show what I recommend.

If you are wondering why the C: drive specification is not given before the directory name here (apart from in the PATH command) it is so that the startup files can be copied to a boot disk needing only one small amendment (see Boot disks, p. ).

I have given two examples:

  • DOS 5 with smartdrv.sys

  • DOS 6, Windows 3.1 or 3.11

Read the text after the examples where I also give some possible lines that are not shown here. If you don't need EMS memory, then my examples and suggestions for start files are as follows.

The boot process

(A) These are some of the procedures set in motion during the boot process: after a program built into a ROM chip has checked the hardware (memory, ports, video adapter, etc.), information from the ROM BIOS is loaded into RAM memory. The first thing it looks for are the system files, i.e. the hidden files IO.SYS and MSDOS.SYS for MS-DOS.

At this point in the boot process, the computer doesn't know which devices are installed. Every device needs a program (software) that can manage it. Only when this is running can the device become "a member of the family" of PC parts that communicate with the others. If all these processes succeed, the DOS operating system is ready.

DOS 5: If there are no problems up to this point, the PC cannot lock during boot, no matter what lines are in AUTOEXEC.BAT. So, at the very least, it is important to have a CONFIG.SYS file that doesn't make fatal errors.

DOS 6: It is (almost) possible to jump over all of CONFIG.SYS by pressing F5 when you start to boot - see DOS 6 for more details.

At the start of the boot process, conventional memory is empty. CONFIG.SYS is run through twice. The first time, the line DOS=HIGH and apparently also DOS=UMB is searched for, so it doesn't matter where these line are. If the second run finds HIMEM.SYS, it starts by loading it into conventional memory, followed by emm386 if it is there, and then DOS is loaded into high memory. Then it goes on loading drivers and other programs into RAM.

CONFIG.SYS

The lines are read in a certain order, no matter where they are placed - except for device drivers. First, the whole group of device(high)= is loaded in the order they appear. Therefore, this order has an important bearing on how upper memory is used. Then (even if the lines do not exist) the lines files= fcbs= buffers= lastdrive= and stacks= are read.

Finally, COMMAND.COM, the program that interprets DOS commands, is loaded, possibly via a line SHELL=.

Fortunately, drivers can enable a device to perform differently in different circumstances. You decide how much of your RAM you want to use for different things. On each line, you can specify one or more parameters (a sort of variable) and optional switches. A switch can be ON or OFF. A parameter usually refers to the object in question, in this case a device. A parameter is a value - not necessarily a number - that can only be one of several options available to the parameter. For example, the parameter day can only be one of seven possible values.

This is both good and bad. If you know all the different combinations and their relationships, that's fine. However, as most people discover, trying to memorize them is a shortcut to madness, so this section will try to help you out.

Remember, I have written ".." (dot, dot) for the relevant directory instead of "[path]."

DEVICE=..\HIMEM.SYS

HIMEM.SYS must be placed before EMM386.EXE. HIMEM.SYS is the memory manager for high memory as well as extended memory.

Important: it is not until DOS reads this line that high memory and extended memory exist in a state that can be used - now they have a memory manager that allows access. By specifying this, all memory above 1088 KB is configured to be available as XMS memory. 

DOS=HIGH

The condition here is that HIMEM.SYS is active. DOS=HIGH means that DOS places as much of itself as possible in high memory. This is one of the most important features of DOS 5.0 -doing this frees more space in conventional memory to run programs. You are also able to use high memory for other things.

 

If you have a 286 with at least 1 MB RAM, maybe you can use high and/or upper memory, or maybe not. To use upper memory, first you have to have special hardware - which only some 286s have - and then you have to have an upper memory manager. Unfortunately, I don't have any experience with an upper memory manager for a 286. You can find out if your 286 can use high memory. Insert these two lines at the beginning of CONFIG.SYS

device=C:\..\HIMEM.SYS

DOS=HIGH

and see what appears on screen when you boot. If you don't see it, then type MEM when the PC has finished starting. The last line should read MS-DOS resident in high memory Area

If not, you'll get the message unable to control A20 line

Then try with ..HIMEM.SYS/machine:11

The number is a machine identification. Allowable values are from 1-14 (see your DOS manual) or experiment, starting with 11, 12 or 13. I've managed to get it to work on some PCs. If it works, then you've got DOS in high memory, which will make your PC faster because you've got more conventional memory free. Use MEM or MEM/C/P to check. You should have more memory available for programs. If you can't use upper memory, you must write device= instead of devicehigh= as well as remove any references to LH in AUTOEXEC.BAT.

386

.. EMM386.EXE ..

EMM386.EXE can only be used on a PC equipped with at least a 386 processor. This program is a science in itself with numerous options, not all of which are dealt with here. This long explanation is necessary because it is an important file when it comes to how memory is used.

The program has two basic functions: it can be a memory manager for EMS memory and it provides access to the upper memory area. Confusion can arise because EMM386.EXE can be used as a driver as well as a DOS program. We haven't run across this before. It is uncommon to find a device driver that at the same time can also run as a program from the DOS prompt. And the manual ... forget it!

Before reading this line during boot, all RAM above 1088 KB is configured as extended memory. HIMEM.SYS is first of all a memory manager for upper memory but if DOS=UMB is specified, then DOS, via EMM386.EXE, takes control over upper memory from HIMEM.SYS. After you load HIMEM.SYS and EMM386.EXE, it is possible to start to load programs with devicehigh and LoadHigh.

LH is short for LoadHigh, which means load into upper memory. LoadHigh and devicehigh should have both been called LoadUpper - the whole thing is totally confusing. If you are trying to load a program/driver into upper memory using a devicehigh or LH and there is no space for it, it loads into conventional memory instead. You don't even get an error message.

DEVICE=..\EMM386.EXE NOEMS

I am going to start with the setup that is relevant for most people. This is the parameter NOEMS, which means that some of the extended memory should not be converted to EMS memory. NOEMS also means "create an entrance to upper memory." You use this if you don't need EMS memory, wish to use upper memory and want all your free RAM over 1,088 KB to be used as XMS memory.

Technical corner: With DOS 5, the message I get is 92 KB total available upper memory and 92 KB as largest block, starting with address C800 if I have specified NOEMS.

I=E000-EFFF

(A) Of no importance to the PS/2. This line is a parameter that is independent of other parameters and can be in the same line as EMM386.EXE. It includes an address area in upper memory and depends on the area not being used by anything else - and anything else in this context means something from the system, like the motherboard BIOS.

An area in memory is defined by a start and an end address. As a rule, numbers in base 16 are used, here with only four digits to each - the last 0 is dropped. As an example, the 64 KB in the area from 896-960 KB becomes E000-EFFF. EFFF is the address just before F000. Every area of 64 KB is referred to as a page, the A-page, B-page and so on. 640 KB = A000, etc.

EMM386 from DOS 5 defaults not to include this area because it is used by the PS/2 to hold BIOS ROM but EMM386 from DOS 6 does include it. If you want to exclude an area from upper memory (to be sure that no program uses it), specify it in the same way but use an X instead of an I, e.g.

X=B000-B7FF

which excludes this area, called the monochrome region, the region where the CPU communicates with a monochrome (black and white) video card. It is preferable to include this section, rather than exclude it. See the comments under Memmaker in DOS 6.

Requires EMS memory

Some programs need EMS memory. The most important thing about understanding EMS and upper memory is that most EMS-dependent programs demand that 64 KB consecutive UMB be used to make what is called a page frame.

On the subject of expanded memory, two parameters will be discussed in detail - RAM and AUTO (because the manual mentions them only briefly and even then it is wrong as far as the AUTO switch is concerned). The DOS 6.0 Help function is also wrong. 

Let's say that you have a total of 4 MB RAM. You will have 3 MB extended memory after installing HIMEM.SYS - I'm disregarding the 64 KB in high memory for a moment to make things a little easier. EMM386.EXE is able to convert extended memory to expanded memory, so if you want to use 1 MB (= 1024 KB) of your 3 MB extended memory as expanded memory (keeping the remaining 2 MB as extended memory) and want access to upper memory, write

DEVICE=..\EMM386.EXE RAM 1024

RAM means "give access to upper memory." 1024 means use a maximum of 1024 KB for EMS memory. If you only give a number, you will be denied access to upper memory.

I=E000-EFFF FRAME=E000

(A). Refer to I=E000-F000 earlier.

Irrelevant for the PS/2. Following LIM EMS specifications versions 3.2 or 4.0, EMS memory uses page frames, which I don't describe more fully here. But most programs that need EMS demand a page frame (a "window" in upper memory) that points towards a portion of EMS memory. It is very important that this 64 KB window be available in upper memory - otherwise it is "stolen" from conventional memory, and this is a big portion to give away.

Unfortunately, emm386 in DOS 5 defaults to a page frame start address of D000, because the IBM PS/2 places the motherboard BIOS ROM here. - if you install, for example, EMS memory with the parameters RAM 1024, during boot you will see this as "starting at address...."

The parameter FRAME=E000 determines the start address for the page frame. The example mentioned above makes better use of upper memory.

EMM386 in DOS 6 has been improved. It would seem that MEMMAKER tests to see if E000-EFFF (the E-page) is free, and if it is, it chooses E000 as the start address. At any rate, that is how it works on my PC.

FRAME=NONE

(A) It is possible that your programs that use EMS memory do not need a page frame (though this applies to very few programs that use EMS memory).

If you would rather take advantage of the 64 KB in upper memory, by letting Windows or other programs use it, you can specify this parameter. If you use DOS extended programs such as AutoCad386 or Lotus 1-2-3 ver. 3.x, which expand memory above DOS' normal limits themselves, you should check with the manual to see whether or not you will benefit by writing this.

This is undocumented in DOS 5.0, while DOS 6.0 mentions it, and adds that it may cause some programs not to function properly. The box at the bottom of the page shows some example parameters for emm386.

DOS=UMB

means that DOS takes over the handling of all upper memory. DOS requests HIMEM.SYS to pass over control of all upper memory. You can write the two lines as one:

DOS=HIGH and DOS=UMB as DOS=HIGH,UMB

but as they are two separate commands, I have chosen to write them as two separate lines.

REM DEVICEHIGH=\..\CDMKE.SYS /D:MSCD01

This is a driver for a Panasonic CD-ROM drive that I activate when I need it - it uses 11 KB. The name given after /D: identifies the CD-ROM drive to the MSCDEX program that is called in autoexec.bat.

 . . devicehigh=\DOS\smartdrv.sys 512 256

This line is only relevant if your disk cache is the not-so-good SMARTDRV.SYS from DOS 5, that is, you do not have Windows 3.1 or DOS 6. If you do not know what a disk cache is, read the general description SMARTDRV disk cache on p.  then return here.

The numbers are the amount of KB for the cache's initial size and minimum size. You are free to choose whether you want to state just the first number, both numbers or none at all. The optimum numbers depend on the available amount of extended memory. The default for the first number is 256.

The last number is relevant for Windows. Certain programs have the ability to change the minimum size and even give it a value of 0 in order to use this area in memory themselves.

To avoid this you must state the minimum by setting the second number. I am assuming that you have not installed expanded memory. The above is an example with 2 MB total RAM and NOEMS at EMM386.EXE. In other words, 960 KB available XMS memory. When you have used 512 KB for SMARTDRV, you are left with 448 KB available for programs that can use extended memory. If you know that this is not the case for your programs, try and set the first number higher and see if that speeds up your system.

If you have 4 MB total RAM, write 1024 512. You do not need to use a disk cache - it is, however, recommended.

(SMARTDRV only became an acceptable product with the introduction of ver. 4.0 from Windows 3.1, and became worth using with version 4.1 from DOS 6. If you have SMARTDRV.EXE, you are much better off. You should not load it from CONFIG.SYS but from AUTOEXEC.BAT. You can still use SMARTDRV.EXE 4.0 even if you only have DOS 5.

..RAMDRIVE.SYS 2048 /E

Relevant if you have Windows 3.1, a minimum of 8 MB RAM and use programs that work intensely with temporary files. Windows and many Windows programs do this, e.g. CorelDraw.

It creates a RAM disk (IBM usually calls it a virtual disk), i.e. a temporary hard disk that exists only electrically while your computer is running. During the boot procedure, you will see the next available drive letter, at the end of the virtual disk line. The number specifies how much RAM is set aside to behave as a disk. Here it is 2048 KB of extended memory - indicated by the /e.

If you want to use EMS memory (you may have a card with expanded memory), use /a.

The risk with this is that if the computer hangs or there is a power failure, all data in the RAM drive is lost. The advantage is faster access to data when you work intensely with temporary files. It requires that you enter in AUTOEXEC.BAT the line 

SET TEMP=D:\

(or your next available drive designation). 

..DISPLAY.SYS CON=(,,1)

Is the driver for the console. The first parameter, which refers to the type of monitor/graphics adapter, need not be stated since DISPLAY.SYS checks the video adapter automatically.

The second parameter refers to the number of the codepage for the console supported by the hardware. In my experience, if you use mode con cp prep and mode con cp select in AUTOEXEC.BAT, where this codepage is chosen. If your hardware (video card) doesn't support one of the codepages for your country, you must give a number. To see this, type mode con in DOS.

The third parameter (here, 1) is the number of codepages needed for which space has to be reserved in memory (but still only for CON and not any other device). The default is 1. If you only want to use one codepage, e.g. 850, write 1 at the end.

All this is necessary to be able to use mode con cp prep and select in AUTOEXEC.BAT.

For two codepages: If you choose 2, you will be able to shift between codepages at the end, e.g. 437 and 850, providing you have prepared them (see mode con ..) and loaded NLSFUNC in AUTOEXEC.BAT. This allows you to switch between codepages with the command CHCP 437 or CHCP 850. display.sys occupies 8.1 KB.

See buffers to see how many buffers can be loaded into high memory.

...SETVER.EXE

Some programs - typically older ones - need access to a certain DOS version number. SETVER lies to these programs about the version number. Type SETVER to see this. Requires 432 bytes.

..GMOUSE.SYS

Loads a mouse driver for DOS programs. Windows has its own driver but this is only for Windows programs. This example is for a Genius mouse. Your mouse driver may be called something else and be located in a different directory.

..ANSI.SYS

Is a driver for screen characters, cursor movement and defining the keyboard keys. Necessary for DOS if you want to use something other than the default 25 lines of 80 characters, changing the colors on the DOS screen, etc.

COUNTRY=044,437..

In this example, I have chosen an English user who wants to use codepage 437 as the active general codepage. The first number, in this case 044, sets English formats for time, date, currency symbol, sort order in files and characters used in directory and file names.

The second number sets the active codepage, the general active codepage for all devices that are supported by it.

If you leave the second parameter blank, you will automatically choose, during boot, the default codepage (see the manual for the country command or with DOS 6.x, type at the DOS prompt help country and select notes) and not the alternative codepage. On an "English-speaking" PC, the default codepage is 437 with 850 as an alternative. In this example, the default codepage is selected.

BUFFERS=5

Is a mini cache programme. If you are using SMARTDRV I would suggest that you set the number of buffers low, to 6 for instance. Every buffer uses about 532 bytes. If you do not use a disk cache program, then you should experiment a little. Try values of between 6 and 20 and see which one works best on your PC. You will not have any problems, just a slightly faster or slower computer.

The majority of buffers should, according to Microsoft, be loaded into high memory if there is room there. Whether I used MEM/C/P or MEM/D/P, I could not see any evidence of this. I discovered the cause later: if DISPLAY.SYS is loaded (and this happens in all non English-speaking countries to allow access to country-specific letters and symbols), then something happens in high memory. An educated guess: the codepages that have memory reserved for them via DISPLAY.SYS take up space in high memory.

Experiments showed that if DISPLAY.SYS is loaded with the last parameter (number of codepages) set to 1, the result is that only 27 or fewer buffers can be held in high memory, with 512 bytes used in conventional memory. With 28 buffers, all of them are pushed down into conventional memory. Another peculiarity: with buffers=24-27, command.com uses 5 K, otherwise it uses only 3 K. If you are loading a single codepage, the most efficient way is to specify buffers=23.

If the last parameter in display.sys is set to 2, then only eight or fewer buffers can be placed in high memory. With nine buffers, things go wrong. With buffers=6-8, command.com fills 5 K, otherwise it only fills 3 K. With two codepages specified, the best setting is buffers=5. Luckily, there are only a very few users who need so many buffers, as nearly everybody uses a disk cache like SMARTDRV, but it is a mistake that the manual or Help does not explain this. Almost certainly, the Americans have never even discovered this problem, as they do not need display.sys. (IBM's PC DOS 6.1 and 6.3 behave in exactly the same way).

If you want to test things out, then use MEM/D/P after every boot, and look for BUFFERS. You can also use the undocumented MEM/A, which also tells you about high memory. 

FILES=40

The default (if the line isn't included) is 8. Valid: 8-255. Specifies how many files can be open at the same time. A file is "open" when it is in use or being read. Today, many programs need to have a lot of files open at the same time. If you use Windows and run several programs simultaneously, you require a higher amount.

Some space is taken up in memory for this but not much. Try 30, 40 or 50 and see how it works. I wonder why Microsoft does not provide a program that shows the number of open files.

REM FCBS=X

File Control Blocks. Certain older programs, e.g. SideKick, access files by means of FCBs. The value x states how many of these blocks DOS can have open at the same time. The default is 4.

If you do not know whether or not your program requires FCBs, try setting the value at 1. If you get no error messages, you have saved a little memory.

REM STACKS=9,256

The numbers given here are only examples. The default (if the line is not included) is 0.0 for the original IBM PC and 9,128 for all others. Specifies how much memory is set aside to handle hardware interrupts.

An interrupt is when there is a "...telephone call for Mr. DOS" while it is doing something. If you press a key while DOS (and hence the processor) is in the middle of a task, it will be taken as a call that cannot be ignored. So DOS will temporarily place what it is doing on a "shelf" in what is called a stack (a little buffer) while it handles the interruption. When the interruption is over, DOS returns to what it was doing.

Examples of interrupts include clicking or moving the mouse, hard disk activity or an incoming fax. Many interrupts occurring at the same time can use up the stacks reserved here; the solution is to increase the number.

The first number gives the number of stacks. Valid numbers here are 0, or from 8 to 64.

The second number specifies how many bytes are set aside for each stack. Valid numbers are 0, 32, 64, 128, 256 or 512. If you have extra cards for a scanner, fax modem, modem or similar device, and have ever had an error message stack overflow, you can try raising the values and see if it helps. Try 9,256 - 9,512 - 10,128, etc.

If you don't have an original IBM and you don't have this line in your CONFIG.SYS, you waste memory unnecessarily. If you want to aim for the optimum setting, try STACKS=0.0. It may just be that none of your programs requires these stacks. If you encounter problems, then write STACKS= 9,128 - which is the same as omitting the line. If you need a higher number, it is already there so you can change it more easily. It does, however, use some conventional memory, only a tiny amount, but it's worth mentioning. 

BREAK=ON

Increases the number of times DOS checks to see if the user has pressed Ctrl+C or Ctrl+Break (pause key) to stop a program. However, certain programs are written so that these keys have no effect. break=ON means here that you can break a program with Ctrl+C or Ctrl+Break. break=ON has no effect on the use of RAM.

SHELL=.. /p /f /E:1024 SHELL=..\DOS\.. /p /f /E:1024

Some people place COMMAND.COM in the root and don't have a line stating SHELL=, which is OK. Others place COMMAND.COM in C:\DOS together with this line, showing where it can be found. The first is the easiest way as by default the boot process looks for COMMAND.COM there but the line above can specify where it is.

Placing it in C:\DOS is also reasonable because you seldom work in the DOS directory and therefore you're not likely to delete COMMAND.COM by mistake. If you delete COMMAND.COM in error then you'll lose your command interpreter. Solution: boot from a floppy and copy it from the floppy to the hard disk. You can now - again - boot from the hard disk.

/p means that you have specified the permanent command interpreter - you may use another but that is not dealt with here.

/f means that the option Fail, is chosen if you get the error messages Abort, Retry or Fail, which typically happen when a program tries reading a diskette drive and finds no diskette.

/E:1024 - another very important purpose of this command is to expand the Master DOS environment to the number of bytes specified at the end of the line. This is a sort of bulletin board in memory, where DOS and other programs save and retrieve certain internal information and variables.

Some programs require that a variable be defined in this environment, and during installation of such a program, a line in AUTOEXEC.BAT is inserted or recommended, e.g. set lib=C:\QB. Try entering SET and HELP SET at the DOS prompt; it will give you an idea of what it is all about.

If a line with SHELL= isn't included, DOS 5 sets aside 160 bytes and DOS 6 earmarks 256 bytes.

If you get an error message Out of environment space, you can try increasing the number in this line. I have never needed it to increase the amount of bytes, but Microsoft recommends setting the number to 1024 or 2048 for Windows 3.1. It is a question of a very few bytes, so you use very little conventional memory, 1 or 2 KB.

If you have a long path statement, with around 127 characters, then 127 bytes are used for this so it might be relevant to set a number here. Most people will find, that 512 or 1024 works fine.

DOS 6.0: MEMMAKER inserts this line if it isn't found, although without /e:1024

Other possible lines in CONFIG.SYS

Even this guide has its limits!

REM LASTDRIVE=X

This stipulates the maximum number of drives you can access. The default is the next available drive, which for most people is drive D. You waste memory if you write Z without needing it.

Network users: certain network programs attempt to create drive names beyond the maximum, in which case Z does not work.

FASTOPEN

If FASTOPEN is specified in your CONFIG.SYS, I recommend that you delete the line. The idea of having fast access to files is attractive, but users have reported damaged files as a result of using it. This file is also included in DOS 6.

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.

Facebook Twitter Google LinkedIn Emailemail to friend

You are on michaelmaardt.com • © Michael Maardt 21. Jul. 2018