Configuring your MS-DOS properly

Table of Contents

  1. History
  2. MSDOS.SYS
  3. CONFIG.SYS
  4. AUTOEXEC.BAT
  5. Comments
  6. Smartdrive
  7. Ramdrive
  8. Windows 95
  9. Full Hard Disks
  10. Defrag, Scandisk

0) Preface

I have noticed that many users have little or hardly any knowledge of the basic configuration topics. In the last years I have been asked very often to have a look at someone's "autoexec", because something was not working as expected. Perhaps you have had (or still have) those problems. If you think you're an config.sys expert I would suggest you still read this document, as it contains perhaps some tricks and features you do not know yet.

1) History

In the good old days there was MS-DOS (sometimes people used PC-DOS, the clone from IBM for their pc-series. Later on DR-DOS was used for some days mainly because it was some $ cheaper...). When IBM designed their first PCs they only had the MDA textmode capability. The MS-DOS that was delivered had (and still has) relatively good support for textmode (have a look at INT10h). But some years later everybody was able to purchase graphic adapters that could display bitmapped graphics. The PC design was not really prepared for this and most software still used textmode. But with the introduction of Microsoft Windows things changed. Microsoft presented a standard for graphic user interfaces, so nearly everybody could use the new look. And hardware manufactores supplied drivers for their products, and soon the complete PC world only wanted Windows. (I herewith omit the fact that Win1 and Win2 were no real successes. The hurry started in 1990, when Windows 3.0 was introduced).
But there was still lots of software to run on MS-DOS and people wanted to use those old software packages. So Microsoft did not program Windows as a standalone operating system (which they could have done, if they wanted), but rather as a graphical add-on for MS-DOS. Again some years later some companies shouted MS-DOS is "out", mostly to sell their own operating systems (mainly IBM with OS/2). So Microsoft had to react. In fact they always tell you that their product Windows 95 is a complete operating system no longer relying on MS-DOS. But don't trust them. It is all the old way! Every time you start up your Windows 95 machine, MS-DOS (in this case v7.0) is started. Command.com then starts a file called win.com in your windows directory. If you don't trust me, then rename your win.com to some other name and reboot your machine. You will notice, that you have the classic command.com interface. If you quit windows again you will get a nice picture telling you that you can turn off your computer. But the whole truth is, that you are now back to MS-DOS, but your graphic card is still switched to gfx mode. If you type mode co80 and press enter you will get the classic command prompt.
Summary: Windows95 behaves just as Windows 3.x did and we can get some advantages of this fact.

2) MSDOS.SYS

In fact Microsoft has prepared their software for the things we want to do. So at first you should rename your renamed win.com to the original name again. Then you have to go to the command prompt, either with a shell in Windows or from boot disk, or which ever way you prefer. Now we want to have a look at the file MSDOS.SYS. Before Win95 this file was needed to boot up the machine together with IO.SYS and every computer has this file on its hard disk in the root directory. With windows 95 and dos 7.0 things changed. MSDOS.SYS is not longer a binary file. But of course it is hidden, system and protected, so at first we have to set some proper attributes:
attrib -r -s -h msdos.sys
no we can have a look at this file in our favourite text editor:
edit msdos.sys
Mine look like this:

[Paths]
Windir=c:\windows
Winbootdir=c:\windows
Hostwinbootdrv=c

[Options]
BootMulti=1
BootGui=0
Logo=0
Network=1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

and there are a couple of ; lines more to follow...
As in all Microsoft configuration files this file is seperated in sections. Each section starts with a key word in brackets []. The PATHS section should be no mystery to you and you normally don't need to change it. But very interesting is the next section, the OPTIONS section. Here we find 4 entries. If some of the entries above are not listed in your msdos.sys that is somewhat normal. But you can just insert them.

BootMulti
this option enables multiple boot configurations. Even if you only want on configuration it does not hurt to enable this option.
BootGui
now this is a real highlight. Window's Setup enables this option and therefore the command processor load windows every time the machine starts. By disabling this option you will get the command line at startup and can start windows easily by typing "win". So disable this.
Logo
Many people find it totally cool to have big background and startup pictures. I personally prefer the classic style of a black screen. This option enables the startup picture, so I disabled it.
Network
If you want to use Network enable this.

If you've modified the file according to your needs save it. Then exit your editor and make it protected again with:
attrib +r +h +s msdos.sys

3) CONFIG.SYS

Now we go a little bit deeper into the configuration. We will now handle our config.sys file. But before we edit it, we have to get some overview of what our system think it needs. The mem programm fits our needs. type:
mem /c/p
my output look like this. you will later notice (when you are an expert) that the above command is the best utility when optimizing your configuration. Here is my output (of course it is optimited for my needs already):

  Name           Gesamt      =  Konventioneller  + oberer Speicher
  --------  ----------------   -----------------  ----------------
  SYSTEM      34.640   (34K)     10.640   (10K)     24.000   (23K)
  HIMEM        1.168    (1K)      1.168    (1K)          0    (0K)
  EMM386       4.032    (4K)      4.032    (4K)          0    (0K)
  4DOS         4.784    (5K)        432    (0K)      4.352    (4K)
  TEAC_CDI     8.048    (8K)          0    (0K)      8.048    (8K)
  EANSI        1.920    (2K)          0    (0K)      1.920    (2K)
  IFSHLP       2.864    (3K)          0    (0K)      2.864    (3K)
  SETVER         832    (1K)          0    (0K)        832    (1K)
  KEYB         6.944    (7K)          0    (0K)      6.944    (7K)
  MSCDEX      23.904   (23K)          0    (0K)     23.904   (23K)
  MOUSE       29.712   (29K)          0    (0K)     29.712   (29K)
  HYPERKEY     2.816    (3K)          0    (0K)      2.816    (3K)
  UNIVBE      12.560   (12K)          0    (0K)     12.560   (12K)
  Frei       711.248  (695K)    638.384  (623K)     72.864   (71K)

hmm, seems I have a german version of windows installed. But on other language version things should look similar, so I guess you won't have any difficulties. The above is not the complete output of mem /c/p, but everything we have to know now. We clearly see that DOS manages two different memory blocks, the conventional and the upper memory block. I think the best would now be to explain those terms now. again some history:

The original PC in 1980 had a 8088/8086 which could handle 1MB of memory. But 1MB of RAM was very expensive, so the designers made a hardware design for the pc using the lower 640K for the operating system and user loadable programs. The memory from A000-CFFF was reserved for the graphic card. As the user could plug in additional cards which could need some memory too, D000-EFFF was reserved for card roms. Finally the BIOS of the computer needs some memory adresses to image their ROMs too, which was located from F000-FFFF. So the whole addressable memory from 0000-FFFF was used in the pc-design.
But things turned out to develop in a different way. Today no card uses the memory from D000-EFFF. The VGA BIOS which could use C000-CFFF is often smaller. The same applies for the system BIOS which often only needs 32K. And modern computers have more than 1MB of RAM installed so there is physical memory which can/should be used!
I would suggest that you take a look the the programm UMBINFO now. Although this is a german programm to present a card, which was needed about 10 years ago it has a very interesting feature which lets you explore you dos memory. Select Speicherbelegung and you can browse through your lower 1MB memory and explore the installed programs and tables. Have a close look on the points System Bios and ROM Erweiterung (the one starting at C000) and write down their start/and adresses.

But now back to our mem /c/p printout. All programs listed here are drivers and tsr programs currently loaded. Please write down their memory usage now. For example my cd-rom driver TEAC_CDI uses 8K of ram. If you notice that your HIMEM.SYS driver uses about 45K of memory you have installed a Win95b version, which has a bug in the IO.SYS file. There is a patch from Microsoft which you should definatively apply!

Now we have to manipulate our config.sys so load it into your editor:

DEVICE=C:\windows\HIMEM.SYS /testmem:off
DOS=HIGH,UMB
LASTDRIVE=z
COUNTRY=049,850,C:\windows\COMMAND\country.sys
SHELL=c:\4dos\4dos.com c:\4dos /p /e:1024
DEVICE=C:\windows\EMM386.EXE noems d=64 x=a000-c7ff i=c800-f7ff x=f800-ffff
rem DEVICE=C:\windows\EMM386.EXE 28000 ram d=64 x=a000-c7ff frame=c800 i=d000-f7ff x=f800-ffff
DEVICEHIGH=c:\utils\TEAC_CDI.SYS /D:TEAC
DEVICEHIGH=C:\utils\eansi.sys

If you have never touched this file before and installed some programs it is normally in a very bad order. But we will make it orderd and good now. If your config.sys file does not include lines I talk about you can just add them. The first line should definativly start the HIMEM.SYS driver. This driver is needed for memory management and most programs rely on its presence. But himem is a very critical program and wants to check your memory every time you boot up. Modern RAM chips do not break down, so there is no need to check every single bit when booting each time. You should apply the /testmem:off switch. You will notice that himem now boots in 0.5s!
The second line should consist of dos=high,umb. high tells you system to load the main part of dos into the High Memory Area (HMA, a 64K segment above 1MB, which can be used with a trick on i386). This will save you 64K of conventional memory. umb is a directive for emm386 (we'll cover it soon) to be able to load normal dos programs into the upper memory area (remember? the memory between C800-F7FF). lastdrive is not really needed, but does not hurt. normally this is set to f. But if you have some hard disks, cd-rom, and perhaps other removable media drives installed f can lead to a problem. Or if you want to install network drives. So set this to Z and be save.
The line with the Country code is normally created by the setup program and prepares your keyboard for nation specific standards. Leave this line as it is.
The next line is perhaps the most important line in your config.sys file. The second driver loaded should be EMM386. This multi purpose programs handles two things. It provides additional memory manangement routines needed by many programs and it is able to load DOS programs and drivers into the UMB. Note that you can not load Himem or Emm386 "high" as these two programs provide the option to load other programs high. They can't load themselves high.
The memory above 1MB can be configured in three different ways. If you do not load himem.sys the memory is not configured at all and can only be accessed by protected mode programs. When loading himem.sys the memory is configured as XMS memory (eXtended Memory System). This is the prefered method ! But in the 80's there was a second standard for additional memory called EMS (Expanded Memory System). emm386 can now simulate EMS within the XMS. Today some programs still want EMS memory (for example Impulse Tracker or Wing Commander 1+2). But as this memory technique is far outdated you should look out for better programs. However if you have to use EMS you can modify your config.sys accordingly. Unfortunately if you load emm386 without any switches it configures itself with a small amount of EMS (I think 2MB) and the rest of the memory is left as XMS. But we (normally) do not want any EMS memory at all, so we start it with the NOEMS switch.
If you want to use EMS simply type the number of Kilobytes as a value in the line (my config uses 28000 KB). Due to a design bug in emm386 you then also have to use the RAM switch to enable the use of the UMB for programs.
The D switch defines the maximum number of KB for a DMA transfer. Default value is 32, but some programs want some more DMA buffer. A value of 64 should be good.
Now the really importand switches x and i. We want to use the memory between A000 and FFFF (UMB). But some of this memory is reserved, so we have to tell emm386 which part it can use. I hope you have tried out the UMBINFO programm and got an overview over your system! (although I think most system should work well with my values, there is no guarantee)
We know that memory between A000 and CFFF is reserved for video. And F000 - FFFF is reserved for System BIOS. The memory in between is normally not used by any cards you might have installed (except perhaps some very old network cards). So fail save values would be:
x=a000-cfff i=d000-efff x=f000-ffff
emm386 now knows that memory from a000-cfff and f000-ffff should not be used, while d000-efff is ready for programs to be occupied.
But I know that on my system (and I think this applies for yours too) my video card only uses memory up to C7FF and my system BIOS starts at F800. So I can modify the line to:
x=a000-c7ff i=c800-f7ff x=f800-ffff
This will get another 64K of RAM !

Notice that emm386 is normally installed by setup.exe with the highscan switch. Documents claim, that highscan does the same thing we did right know, but I never saw it working. highscan normally uses very little free memory and I suggest you delete it from your emm386 line, now that you know how to do it by hand. And there are some more 32K ready. Coders know that text mode starts at B800. But the graphics memory ends at AFFF. So what lies in B000-B7FF ??? It is the textmode memory for monchrome graphics cards. If do not have one installed you can use this memory too, so change to above to:
x=a000-afff i=b000-b7ff x=b800-c7ff i=c800-f7ff x=f800-ffff
(you might have guessed already that I own a hercules card, so I could not use this last line). Some graphic cards I have seen also use b000-b7ff, so this very last optimization might not work for you. You have to try it out.
Now, sometimes we want to boot our machine with EMS memory. So we install a second line in our config.sys file with a prepared emm386 line, so we can easily rem out the correct driver. The EMS technique needs some memory for a so called page frame. This frame has to be located somewhere. Its size is 32K. So a fail save EMS line:
[EMS in K] ram x=a000-cfff frame=d000 i=d800-efff x=f000-ffff
however the following should work also:
[EMS in K] ram x=a000-c7ff frame=c800 i=d000-f7ff x=f800-ffff
Or fit it to your needs. Remember that you put your frame address manually to the lowest possible location, so there is the highes amount of continueous memory left.

After you loaded the emm386 you can use the devicehigh and lh commands. In the config.sys we only need devicehigh. You should now load all necessary drivers sorted by memory usage. So the biggest driver should be loaded first. You can see that my cd-rom driver needs about 8K, while eansi just wants 2K. So cdrom is first followed by eansi.

The shell option load an alternative command processor (4dos in this case). If you do not want 4dos, ignore this line now.

4) AUTOEXEC.BAT

Now it is time to look at the third part in the boot process the autoexec.bat. I have made a copy of mine again:

@ECHO OFF
VERIFY OFF
SET COMSPEC=c:\4dos\4dos.com
SET TEMP=d:\temp
SET TMP=d:\temp
SET BLASTER=A220 I5 D1 H5 P300 T6
SET SOUND=C:\PROG\SB16
SET ULTRASND=240,6,6,11,11
SET ULTRADIR=C:\PROG\GUS
PATH C:\UTILS;C:\UTILS\P;C:\WINDOWS;C:\WINDOWS\COMMAND
PROMPT $p$g
C:\PROG\SB16\SB16SET /M:255 /VOC:255 /CD:240 /MIDI:240 /LINE:240
C:\PROG\SB16\SBCONFIG.EXE /S
lh c:\windows\command\KEYB GR,,C:\WINdows\COMMAND\KEYBOARD.SYS

IF %WINDIR% == C:\WINDOWS GOTO WEITER
C:\PROG\GUS\ULTRINIT.EXE -EJ
C:\PROG\GUS\ULTRAMIX
LH C:\windows\COMMAND\MSCDEX.EXE /D:TEAC /M:0 /L:I
lh c:\utils\logi\mouse.exe dual 1
vmode 640-90
vmode 800-90
vmode 1024-75
vmode 1280-75
lh c:\utils\univbe
:WEITER

If you never have touched your autoexec.bat I assume it is in a very bad order. So we want to order it at first. Please take some time order your file. It will help you in the future when modifying this file again. Often programs insert lines into you autoexec.bat when they install themselves, although they do not need the information added at all! I normally check my config.sys and autoexec.bat every time I installed new software for modifications. Often these are not needed or the things are already installed, but those stupid setup programs did not scan your files correctly. So some basic understanding of the options described in this file is neccessary. But lets simply start with my autoexec.

At first you have to know that this file is a normal batch file. So every line behaves just as is you would have typed in on your keyboard.

@echo off
this line disables the command processor to disable the "key" output. Programm output however is of course not disabled. This option is personal taste, but most people want this enabled.
verify off
ms-dos has an option to check for errors while saving files. But those methods are so badly programes that they are totally useless and only eat time. So disabling this option can speed up your disk system a bit.
set compec
normally this evironment variable is set by the system, but noone forbids us to set it manually (and we have to set it when using 4dos). If you do not want to use 4DOS, leave this line out.
set temp, set tmp
set the tmp directory for your system. This option is valid for windows too. By default this is set to c:\windows\temp, but my D: drive is some MBs/second faster than my C: drive, so I set this value to D. I suggest you measure the speed of your hard disks (if you have more than one) and set the temp directory to the fastest drive. Be sure to create a subdirectory for temp, as the root directory of a drive can only hold 512 entries !
set blaster...
all other sets are system specific and you should leave them to the values you find in your autoexec.
path
sets the search path for executables. modify it to your needs
prompt
the basic prompt (my prompt is a little bit more complex and uses the advantages of 4dos, but i deleted it, because it is of no use here)

All the above mentioned topics have only modified the internal state of the command processor. By now no program has been loaded or card initialized etc. I suggest that you order your file in the way that set, prompt, path etc. statements are executed at first. Then the drivers and setup programs are loaded.

If you are using Windows95 you will have noticed that you can start a DOS shell from the desktop. Starting this dos shell is a little bit different from booting your system. At first the command processor is loaded and afterwards the autoexec.bat is executed. config.sys is not loaded at all!
No here comes a problem. Because there are some drivers, setup programs etc. that do not like to be loaded inside windows (or windows does not like them to be loaded). For example I have installed two sound cards. A sound blaster 16 and a gravis ultrasound. Now the SB setup programs can be run under windows, while the gravis software does not like to be started with windows in background. So we have to find a way to determine is windows is started. We make this by asking for the evironment variable WINDIR. If windows is loaded it is set to the appropiate directoy, while it simply does not exist, if windows is not loaded at all.
So if you look at my autoexec.bat you see that my keyboard driver is loaded when booting my pc, as well as starting a dos shell in windows. The same applies for the initializition of my sound blaster card. But my gravis is only initialized at boot up, together with my mouse and my cdrom. When windows is running the block between the if statement and :weiter is simpy ignored.

If you load a driver or a tsr program you should always try to load them into the UMB with the lh statement. In my configuration all drivers are loading "high". In fact you can load every dos programm high, as long as it fits into the memory left there. If dos recognizes that the program would not fit into the umb area it is loaded to conventional memory automatically, so you can not make any mistake when using this command.

5) Comments

MS-DOS also provides the ability of multi-boot menues or multi configurations. This option will show a nice menu at startup and you can choose between various configurations. I do NOT recommend the use of it.
Simply because I think that 99% of all users do not need multiple configurations if they set up their system properly. And those multi configuration are very hard to handle and keep up to date. It is often easier to make a small modification to your config.sys of autoexec.bat for one boot if you need a special setup of something than installing a second boot tree and using it perhaps three times a year.

Command.com is nice and working. But it is far from being cool. I would suggest everybody to install 4DOS. It completely replaces command.com and adds dozens of new features to it. If you have installed it once and used it for about 3 hours I bet you never want to use old command.com anymore. Watch out for another tutorial on how to use 4DOS, which I will write in the near future.

6) Smartdrive

Everyone owns the smartdrive program. This program is nice, but its use can be risky. If you use windows mainly you will not need this programm, since windows has its own built in file cache. If you have loaded smartdrive and then start windows windows can not use the memory allocated by smartdrive, so the performance of windows will be infirior than without smartdrive.
If you want to use DOS, smartdrive can be of use for you. But today hard disks are so fast, that the speed advantadge of smartdrive is hardly noticable for normal work. Only when compiling large programs or when copying, deleting, compressing, moving many (small) files smartdrive has it's use.
But be warned that smartdrive by default enables a write back technique. That means that files written to the hard disk will not be written immidiately, but rather when either the cache is full or when smartdrive thinks it would be a good time to do so. But if your system crashes, before smartdrive has flushed its buffer you will have data losses. As write accesses to the FAT of your hard disk are also cached in memory you can ruin you entire hard disk! (trust me, I had this once) Of course you can disable the write back strategie, but then smartdrive is close to uselessnes. My suggestion is that you do not load smartdrive by default, but rather from command line if you want to make many file operations (copy, delete etc). If you have completed your work reboot your machine after a pause of 15sec (to give smartdrive time to flush its buffer). After reboot smartdrive is not longer active and you're on the save side again.

7) Ramdrive

this relict from times when people had very slow hard disks (or no hard disks at all) is totally outdated today and should not be used!

8) Windows 95

Windows has many ways of manipulating the system core. I only suggest one here, because too much damage can be done by twiddling in win.ini, system.ini and the registry. If you want to make a new installation of windows95 go to your local newspaper dealer and buy one of those "windows magazine" which titles every three month "100 new tricks for improving windows speed". Then apply all those patches and prepare your windows installation cdrom :-)
The problem is, that windows is painfully slow and that you can speed up it to a certain degree. But windows is so complex, that I do not recommend those tunings. Either buy a faster pc or install a better graphical operating system (unix). But one thing: windows has always a built in file cache. Normally windows wants to handle its size, but we all know, that windows is not very clever in doing so. So we set two boundaries for windows. Open system.ini in you editor and add/modify the following three line:

[vcache]
MaxFileCache=4096
MinFileCache=1024

So windows knows that it should assign 4MB file cache maximum and hold 1MB cache whatever happens. Experience showed, that those two values provide the best performance. If you don't trust me you can modify them, but you won't see any better difference.

9) Full Hard Disks

Everybody knows the date when their hard disk just has some few MBs left (~5MB). Now we have two possibilites. Delete some programs or buy a new hard disk. But is it really neccessary to delete entire programs? No, but mostly you can delete lots of trash those programs have installed. Have you ever had a look how many *.txt *.bmp *.wav *.wri files windows installed in its directories? And we don't need any of them. So delete them.
The second step would be to browse through your entire hard disk and search for all readmes, file_id.diz, tmp, bak files and I am sure you will find dozens of MB of crap that exists on your hard disk. Normally you should have some close looks on every now program you install. Mostly you get many readme files you never want to read. So delete them Keep your Hard Disk tidy !

10) Defrag, Scandisk

Two very usefull programs. If your windows crashes daily (mine certainly does) you normally do not have to load scandisk manually, cause windows does the job for you every time you boot up again after a crash. If you windows runs fine you should start scandisk from time to time to check for errors. Although those disk errors have reduced dramatically (I remember times from MS-DOS 5.0) they still appear from time to time.
Defrag is a nice program too. This can relocate your files physically on your hard disk. The logical directory structure is not affected by this program. This program can be run from time to time too. But you should not expect any speed increase wonders. If you have deleted many files or if you want to install a new big programm it can be usefull the run this program (after deletion; before installation), as it brings some order to your hard disk. Daily use of defrag is surely overkill.


2004-06-17 © by doj