Windows training

YBET   Hardware IT training

5. DOS: Config.sys and autoexec.bat

1. The config.sys commands - 2. Commands from the autoexec.bat - 3. Memory management - 4. Examples of standard configuration - 5. Boot DOS selective menus

Under DOS, when the computer starts, it first reads the information included in the BIOS (configurable from the 80286 by setup). This firmware to configure the hardware of the PC, including to determine the order of time booting (starting) of disks (floppy disk drive, hard disk, CD-ROM). Once the specified boot device, the PC will read the file systems on the disk to determine if it is actually bootable and boot the OS: command.com, io.sys, and ms.sys (in the case of a Microsoft DOS)

In Dos case, it will read two text-based configuration files one after the other:

These two files are optional and must be at the root of the boot disk.

To not start these files at startup:

To modify these files, you can use the command DOS EDIT (including XP). It is a small DOS text editor implemented as an external file.

2 Standards config.sys commands

The commands listed below are not necessarily installed. Let's start with a summary of the commands:

Break Specifies to DOS to check the combination of keys <ctrl>+<c> (stop) or <ctrl>+<Pause> witch temporarily suspend the operation of the lines of commands, programs under DOS
Buffers Determines the amount of buffers drives (buffer) to be reserved for transfers of data memory - hard drives: 1 to 99.
Country To define the country
Device To load a device driver
Devicehigh To load a device driver into high memory (between 640Kb and 1 MB), since version 5.0
DOS Specifies if DOS can be loaded into upper memory
DRIVPARM To define the characteristics of a disk, hardly used
FILES Specifies the number of maximum files that the operating system can open simultaneously
INSTALL Loads a memory-resident program, the programs can also be started by the autoexec.bat
LASTDRIVE Defines the maximum letter authorized for disks.
NUMLOCK Defines if the numeric keypad is activated the launch, can be configured by the BIOS.
REM (or ;) Note, comments
SET To set environment variables. 
SHELL To set a different shell command.com
STACKS Sets the amount of memory for hardware interrupts
SWITCHES Allows you to select rows of commands in a menu after choosing user from DOS 5.0

Some specific commands to devices are also defined by MS-DOS. These are external files (usually included in the DOS directory). Others are provided directly by the manufacturer of the device. It load by device = [location] \command or if high memory is managed by device = [location] \command

ANSI.SYS Creates ANSI terminal emulation
DISPLAY.SYS Handles switching code pages for the screen
DRIVER.SYS Creates a logical unit referring to a physical floppy drive
EMM386.EXE Stimulates the upper memory for computers based on 386 and higher using extended memory. Some options are available only from version 5.0
HIMEM.SYS Manages the use of extended memory (greater than 1 MB) for the computer-based 286 or higher
RAMDRIVE.SYS Creates a memory area containing the contents of a hard disk.
SETVER.SYS Loading the version table into memory, used for compatibility with old programs.
SMARTDRV.SYS Creates a buffer for hard disk access.

The order of the commands has no real importance, except in the case of high memory management.

  • Device = [location] himem.sys
  • DOS = high
  • Device = [location] Emm386.exe Noems (RAM)
  • DOS = UMB

the following commands with devicehigh

In this case, you can also use DOS = HIGH, UMB (deleting the second line).µ

3 Commands in the AUTOEXEC file.BAT.

The autoexec.bat file is a text file containing the users commands. Some are not pre-programmed operating system but you can also start your own programs by this command (at the end of lists) file.

PROMPT To change the prompt, the command prompt. The most common is Prompt $p$ g that displays the letter of the hard disk and the current directory.
MODE To define the characteristics of communications (COM and PRN) ports
PATH Specifies the search directories and the order in which there are analyzed.
ECHO OFF Allows of not display the commands in the autoexec.bat file when running
SET Sets the environment variables for some programs
CLS does not display commands

This batch file can also define resident programs to download such as DOSKEY (in memory of the typed commands) or SMARTDRV that accelerates access to hard disks.

Loadhigh (LH for short) to run the program in high memory.

4 Memory management.

By the design of the first XT, RAM memory of a PC is divided in three zones:

By default, DOS uses only the area of 0 to 640 KB (base memory). Superior memory management commands appeared with version 3.3. Other commands, including to get free zones of high memory appeared with the 5.0, version 6 use various commands to automate the management of this memory area. The memory of the computer configuration can be displayed by the command under DOS mem.

We consider that the folder where is installed DOS is C:\DOS.

Device=c:\dos\hymem.sys

It is the first command to insert into the config.sys. This program ensures the coordination of extended memory and ensures that 2 applications do not use the same area. Different options exist but are not used.

DOS = HIGH: this command is related to hymem.sys and allows to transfer back into high memory, freeing space in conventional memory for programs.

DEVICE=c:\DOS\emm386.exe allows the management of upper memory. The amount of usable memory can be filled, but this is not necessary. However there are 2 options: RAM and NOEMS. RAM allows to use the upper memory for DOS programs, NOEMS allows to also use more memory but not for DOS (only Windows 3.0, 3.1 and 3.11) programs. Basically, players will use DEVICE=c:\DOS\emm386.exe RAM, desktop applications on Windows: DEVICE=c:\DOS\emm386.exe NOEMS. One final note, the 286 do not allow to use Noems, Windows 3.X does not work in extended mode with this processor, only from the 386.

DOS = UMB allows programs to use the upper memory.

If emm386.exe is started, you can transfer the drivers and programs started by config.sys and autoexec.bat to high memory. In config.sys, the DEVICE command is replaced by DEVICEHIGH. To the autoexec.bat, insert before LOADHIGH (LH for short) commands.

RAMDrive.sys is used especially for the created by Windows 98 Setup disks. This program creates a hard disk in memory area. It is started by the config.sys. The overall syntax is device = [location]ramdrive.sys size disk in KB /e. The /e requires upper memory. Other options may also be used. The drive letter is as follows from that of hard drive partitions.

Example: device=c:\dos\ramdrive.sys 1024 /e

SMARTDRV.exe is a command to the autoexec.bat file. It allows to create a buffer of the hard disk. This accelerates the exchanges but can cause some problems if you turn off your computer. To do this, we create a double buffering (both in memory and on disk) by adding the option/c. Smartdrv /c.

The MEMMAKER utility appeared with version 6.0. It is a utility that will modify the config.sys and autoexec.bat files to release maximum memory Ram.

5. Standard configuration example

5.1 Current configuration, mouse in high memory

CONFIG.SYS

AUTOEXEC.BAT

Memory is managed in the config.sys. We also load an external driver for the mouse. The hard disk buffers is placed at 20 with up to 40 files open simultaneously. The autoexec.bat indicates that the directory is c:\DOS, temporary files are transferred in the c:\temp folder. It displays the prompt in the form drive: directory. We also load high memory utility doskey with the insert option.

5.2 Management CD-ROM

Installing a CD-ROM DOS drive is done in 2 steps. In the config.sys, it loads the specific driver (they are usually all compatible).

DEVICE=c:\CD-rom\cdrom.sys / d: CD001 where CD001 is the name you give to the reader.

c:\dos\mscdex.exe d:CD001 CD001 is the name of the drive specified in the config.sys. You can also use the optional command HL to transfer it in upper memory. In Windows 95 and higher, this file is located in c:\windows\command like the majority of DOS commands. There are more in 2000 and following.

6 Selective startup menu.

The commands above will allow us to define multiple configurations at the start of the back (from DOS 5.0). This allows for example to specify programs to start in some cases. Most commands are inserted into the CONFIG.SYS. Conditional branching from the autoexec.bat pass through controls IF and goto.

To start specifically, you also supported the F5 button that passes the config.sys and autoexec.bat files or the F8 key which allows to accept command line.

The commands below do work only from DOS 5.0. They are also usable in mode DOS in Windows 95 and following.

6.1 Menu commands.

These commands can be inserted anywhere in the config.sys.To create a menu, you create blocks of commands. The first includes the possible choices for the user.

  • [MENU]
  • MENUITEM = normal
  • MENUITEM = games

The menu above displays two options: normal and games. The suite will determine which commands in the choice of the start menu functions.

  • [normal]
  • Files = 20
  • buffers = 10
  • [games]
  • files = 40
  • buffers = 40

In the above example, if the user chooses normal, Files will be set to 20 and buffers to 10. If the choice is games, files will be 40 and 40 buffers.

A particular menu definition [common] allows to execute the commands listed in the block regardless of the user's choice. It should appear first if necessary. An example of config.sys:

  • [normal]
  • Files = 20
  • buffers = 10
  • [games]
  • files = 40
  • buffers = 40

In the above example, if the user chooses normal, Files will be set to 20 and buffers to 10. If the choice is games, files will be 40 and 40 buffers.

A particular menu definition [common] allows to execute the commands listed in the block regardless of the user's choice. It should appear first if necessary. An example of config.sys:

  • [MENU]
  • MENUITEM = normal
  • MENUITEM = games
  • [common]
  • Device= c:\DOS\himem.sys
  • [normal]
  • Device = c:\DOS\ Emm386.exe Noems
  • Files = 20
  • buffers = 10
  • [games]
  • Device = c:\DOS\ Emm386.exe RAM 2048
  • files = 40
  • buffers = 40
  • [common]
  • DOS = high,UMB
  • DEVICEHIGH= c:\mouse\mouse.sys

This example allows to manage both types of upper memory.

6.2 Using the menus to AUTOEXEC.BAT

User is chosen in the config.sys but it can allow to modify commands in the autoexec.bat with the goto %config% command, by using labels. Label names must therefore be defined from the possible choices in the config.sys.

This requires some special commands. At the end of the autoexec.bat file, inserted the label: end. 

Each command group (designated by a label) should resume the end goto command.

Sample menu:

  • path = c:\dos
  • c:\dos\mscdex.exe d:CD001
  • KEYB fr
  • REM end of the configuration for each menu
  • GoTo %config%
  • :normal
  • LH doskey/insert
  • goto fin
  • :games
  • goto exit
  • : end

NEXT > Network command part 1

<- Dos system command

The hardware 1 course: computer and peripherals. The Hardware 2 course: networks, servers and communications