Early in the boot process, the Config.sys file is read for instructions on loading device drivers and the way system memory is to be allocated. Optimal configurations may well vary depending on the intended tasks for the day.
The "MENU" series of statements enable the construction of a menu in Config.sys to allow the user to choose between named configurations during the start-up process.
NOTE: The "Menu" statements are only recognized in Config.sys and cannot be used in batch files; the mechanism for constructing menus in batch files (CHOICE) is not recognized in Config.sys.
Syntax
Config.sys must be constructed in a series of blocks each with a name enclosed in square brackets.
Block title | Contents |
[menu] | The first block should be named [menu] (a reserved block name) and contains the statements that make the main menu. |
[common] | The second block should be named [common] (a reserved block name) and includes any statements to be used by all configurations. |
[config1] | Subsequent blocks can be named as desired and include either those statements peculiar to each configuration or a submenu. |
[config...] |
[submenu1] |
[submenu...] |
|
[common] | The last block should be a second [common] block. This is included because some programs automatically add lines to Config.sys as they install. If these are added to a [common] block they will be included in all configurations. If this is not required, it is easy to move them to an appropriate block at a later date.
|
Notes
- Valid statements that can be included in a menu or submenu block are:
MenuItem | Points to the block containing a particular set of configuration commands. A seperate MenuItem line is required for each distinct configuration. |
MenuDefault | Defines the default MenuItem (which will be highlighted) and may include a timeout. |
SubMenu | Points to a block containing a submenu. |
MenuColor | Defines the displayed text and background colours. |
- The %CONFIG% environmental variable is assigned to the selected configuration and can be referenced later by, for example, Autoexec.bat.
- Block titles must be in square brackets and may be up to 70 characters long (which is getting pretty cumbersome). Although long titles are recognized in Config.sys, the limitations of label length in a batch file (including Autoexec.bat) still apply - i.e. only the first 7 characters are recognized (see the notes on labels under GOTO). Titles cannot contain spaces or punctuation characters recognized as delimiters (eg. [ ] / \ , ;).
Example
This example of a multiple choice Config.sys allows for configuring the system to run under Windows or Dos with/without a ramdisk and/or CDRom support. The Autoexec.bat example that follows uses the %config% variable to load the appropriate programs.
N.B. This example is designed simply to show the structure of a multiple configuration setup and is not intended to be any kind of model for a real world config.sys/autoexec.bat!
[Menu]
MenuItem=Windows, Start in Windows (default)
SubMenu=Dos, Configure for working in Dos ...
MenuColor=12,7
MenuDefault=Windows,10 |
[Common]
device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1)
Country=004,850,C:\WINDOWS\COMMAND\country.sys
device=c:\windows\himem.sys
device=c:\windows\emm386.exe noems
dos=high,umb |
[Windows] |
[Dos]
MenuItem=Ramdisk, Set up a 1Mb Ramdisk
MenuItem=CDRom, Include CDRom drivers
MenuItem=All, With Ramdisk and CDRom (Default)
MenuItem=None, With Neither Ramdisk or CDRom
MenuColor=2,7
MenuDefault=All,10 |
[Ramdisk]
devicehigh=c:\windows\ramdrive.sys 10000 /e |
[CDRom]
devicehigh=c:\windows\ct\sbide.sys /d:mscd001 |
[All]
devicehigh=c:\windows\ramdrive.sys 10000 /e
devicehigh=c:\windows\ct\sbide.sys /d:mscd001 |
[None] |
[Common] |
On startup, the following would display:
Microsoft Windows 98 Startup Menu
===================================
1. Start in Windows
2. Configure for working in Dos .....
Enter a choice: 1 Time remaining: 10
F5=Safe mode Shift+F5=Command prompt Shift+F8=Step-bstep confirmation [N]
|
If neither 1 nor 2 are pressed within 10 seconds, the computer starts up in the "Windows" configuration.
Pressing "2" would open the "Dos" sub-menu:
Microsoft Windows 98 Startup Menu
===================================
1. Set up a 1Mb Ramdisk
2. Include CDRom drivers
3. With Ramdisk and CDRom (Default)
4. With Neither Ramdisk or CDRom
Enter a choice: 1 Time remaining: 10
F5=Safe mode Shift+F5=Command prompt Shift+F8=Step-bstep confirmation [N]
|
Again, if no number is pressed within 10 seconds, the computer starts up with both ram disk and CDRom support.
To go with this Config.sys, Autoexec.bat could be constructed along the lines:
LH c:\windows\command\doskey.com
........
GOTO %Config% | This first section contains commands common to all configurations and concludes with the command to branch to the label set by the selection made in Config.sys.
|
:Windows
......
GOTO Common2
:Ramdisk
......
GOTO Common2
:CDRom
......
GOTO Common2
:All
......
GOTO Common2
:None
......
|
This section contains a series of blocks each beginning with a label identical to the block name used in Config.sys. Each block should conclude with a GOTO command to a final common section. |
:Common2 | The final block is for any commands that might be added by installation programs. This should be checked after installing a program so that any such added lines can be moved to where they belong. |
|