Outils pour utilisateurs

Outils du site


back2root:ibm-pc-ms-dos:ms-dos:6-22-multi-config

Multi-config

MS DOS 6.0 introduced the ability to specify multiple configurations in the config.sys and autoexec.bat. This feature can be used for different situations:

  • Dual boot situation with the option to either boot in DOS with all device drivers loaded (CDROM etc.), or to boot in Windows 95 where it should not load any DOS device drivers.
  • Different memory configurations whether to have lots of conventional memory or expanded memory.
  • Starting DOS with or without support for network or CDROM drives.

This is a simple config.sys, which tries to outline the basics of multiple configurations with the use of MENU and MENUITEM:

[MENU]
REM Define an item in the menu, first identifier and then what is written in the menu
MENUITEM=DOS, DOS with CD-ROM
MENUITEM=WIN, Windows

REM The commands at COMMON is executed no matter what is chosen in the MENU
[COMMON]
DOS=HIGH,UMB

REM For each menu item there can be defined a configuration
[DOS]
DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF
DEVICE=C:\DOS\EMM386.EXE NOEMS
DEVICE=C:\CDROM\DRIVER.SYS /D:CD1
 
[WIN]
DEVICE=C:\DOS\HIMEM.SYS /TESTMEM:OFF

This is a simple autoexec.bat, where the MENUITEM is translated into the environement variable CONFIG:

@ECHO OFF
PROMPT=$P$G
SET DIRCMD=/A/OGN/P

REM Uses the identifier from CONFIG.SYS to goto a label
GOTO %CONFIG%

REM This is the label for the identifier DOS
:DOS
LH C:\DOS\MSCDEX.EXE /D:CD1
LH C:\DOS\SMARTDRV.EXE 2048

REM The GOTO EXIT is required so it won’t continue into the WIN configuration
GOTO EXIT

REM This is the label for the identifier WIN
:WIN

REM The ECHO command writes a message on the DOS screen
ECHO Starting Windows…
 
C:\WINDOWS\WIN

:EXIT

It is possible to extend menu-system in the config.sys with SUBMENU, which enables sub-menus. One can also use MENUDEFAULT to specify the default menu item and how long it should wait before it picks the default.

[MENU]
MENUITEM=DOS, DOS with CD-ROM
MENUITEM=WIN, Windows

REM By using SUBMENU you will creating an extra menu(TEST)
SUBMENU=TEST, Testing

REM Using MENUDEAFAULT makes it possible to choose a certain item(WIN) and if it’s set also select that item after a certain
REM time(20 secs)
MENUDEFAULT=WIN, 20

REM Here is the SUBMENU it can also include other SUBMENUs
[TEST]
MENUITEM=TEST1, Testing 1

To read more about multi-configurations menus execute the following command:

C:\> help multi-config

Commands for Defining Multiple Configurations

A single CONFIG.SYS file can define several different system configurations.

To define multiple configurations, you use the following special CONFIG.SYS commands:

To define multiple configurations, follow these general steps:

  1. Define a startup menu in the CONFIG.SYS file by using a [menu] header followed by one or more MENUITEM commands. The MENUDEFAULT, MENUCOLOR and SUBMENU commands can be used to define special characteristics of the startup menu.
  2. Create a configuration block in the CONFIG.SYS file for each configuration you want. A configuration block begins with a block header 1). To each block, add the CONFIG.SYS commands that you want MS-DOS to carry out when that configuration is selected from the startup menu.
  3. (Optional) In the AUTOEXEC.BAT file, use batch commands such as GOTO and IF to have MS-DOS carry out different AUTOEXEC.BAT commands depending on the startup configuration.

When a configuration is selected from the startup menu, MS-DOS defines an environment variable named CONFIG and sets it to the name of the selected configuration block. To have MS-DOS carry out different sets of commands for different CONFIG values, add a GOTO %CONFIG% command to your AUTOEXEC.BAT file.

INCLUDE

Includes the contents of one configuration block within another. You can use this command only in your CONFIG.SYS file.

The INCLUDE command is one of six special CONFIG.SYS commands used for defining multiple configurations within a single CONFIG.SYS file. With multiple configurations, you define a menu that appears when your computer starts. Each menu item corresponds to a block of commands, or “configuration block,” in your CONFIG.SYS file. For more information about multiple configurations and configuration blocks, see the chapter “Configuring Your System” in the MS-DOS User's Guide.

Syntax

INCLUDE=blockname

Parameter

blockname Specifies the name of the configuration block to include.

The INCLUDE command is one of six special CONFIG.SYS commands for defining multiple configurations. The other commands are for defining the startup menu, and are as follows:

  • The <MENUITEM> command, which defines an item on the menu.
  • The <MENUDEFAULT> command, which specifies the default menu item.
  • The <MENUCOLOR> command, which defines the color of the menu's text and screen background.
  • The <SUBMENU> command, which defines a submenu.
  • The <NUMLOCK> command, which specifies the state of the NUM LOCK key when the startup menu appears. (Although NUMLOCK can be used anywhere in the CONFIG.SYS file, it is especially useful when defining a startup menu.)

Sets the text and background colors for the startup menu. You can use this command only within a menu block in your CONFIG.SYS file.

The startup menu is a list of choices that appears when you start your computer. You define a startup menu by using special CONFIG.SYS commands.

Each item on the menu corresponds to a set of CONFIG.SYS commands called a “configuration block.” A startup menu makes it possible to start your computer with a variety of configurations.

Syntax

MENUCOLOR=cx[,cy]

Parameters

cx : Specifies the color of the menu text. You can specify a value from 0 to 15; For a list of values and colors, see “Color Values” later in this topic.

cy : Specifies the color of the screen background. You can specify a value from 0 to 15; For a list of values and colors, see “Color Values” later in this topic. The y value is optional; if you do not specify a value, MS-DOS displays the specified text color on a black background.

Be sure to specify different values for x and y, or the text will not be readable.

Color Values

Valid color values are from 0 to 15, as follows:

0 Black 8 Gray
1 Blue 9 Bright blue
2 Green 10 Bright green
3 Cyan 11 Bright cyan
4 Red 12 Bright red
5 Magenta 13 Bright magenta
6 Brown 14 Yellow
7 White 15 Bright white

On some displays, colors 8 through 15 blink.

The MENUCOLOR command is one of six special CONFIG.SYS commands for defining startup menus and multiple configurations. The other commands are as follows:

  • The <INCLUDE> command, which includes the contents of one configuration block in another. This command cannot be included in a menu block.
  • The <MENUITEM> command, which defines an item on the menu.
  • The <MENUDEFAULT> command, which specifies the default menu item.
  • The <NUMLOCK> command, which specifies the state of the NUM LOCK key when the startup menu appears. (Although NUMLOCK can be used anywhere in the CONFIG.SYS file, it is especially useful when defining a startup menu.)
  • The <SUBMENU> command, which defines a submenu.

Specifies the default menu item on the startup menu and sets a timeout value if desired. You can use this command only within a menu block in your CONFIG.SYS file. If you do not use this command, MS-DOS sets the default to item 1.

The startup menu is a list of choices that appears when you start your computer. You define a startup menu by using special CONFIG.SYS commands.

Each item on the menu corresponds to a set of CONFIG.SYS commands called a “configuration block.” A startup menu makes it possible to start your computer with a variety of configurations.

Syntax

MENUDEFAULT=blockname[,timeout]

Parameters

blockname : Specifies the default menu item by its associated configuration block. The block must be defined elsewhere in the CONFIG.SYS file. When MS-DOS displays the startup menu, the default menu item is highlighted and its number appears after the “Enter a choice” prompt.

timeout : Determines how many seconds MS-DOS waits before starting the computer with the default configuration. If you don't specify a timeout value, MS-DOS does not continue until the ENTER key is pressed. You can specify a timeout value from 0 to 90 seconds. A timeout of 0 forces automatic selection of the default, effectively bypassing the menu display.

The MENUDEFAULT command is one of six special CONFIG.SYS commands for defining startup menus and multiple configurations. The other commands are as follows:

  • The <MENUITEM> command, which defines an item on the menu.
  • The <MENUCOLOR> command, which defines the color of the menu's text and screen background.
  • The <SUBMENU> command, which defines a submenu.
  • The <NUMLOCK> command, which specifies the state of the NUM LOCK key when the startup menu appears. (Although NUMLOCK can be used anywhere in the CONFIG.SYS file, it is especially useful when defining a startup menu.)
  • The <INCLUDE> command, which includes the contents of one configuration block in another. This command cannot be included in a menu block.

Defines an item on the startup menu. You can use this command only within a menu block in your CONFIG.SYS file. You can have up to nine menu items per menu.

The startup menu is a list of choices that appears when you start your computer. You define a startup menu by using special CONFIG.SYS commands. Each item on the menu corresponds to a set of CONFIG.SYS commands called a “configuration block.” A startup menu makes it possible to start your computer with a variety of configurations.

Syntax

MENUITEM=blockname[,menu_text]

Parameters

blockname : Specifies the name of the associated configuration block. The block must be defined elsewhere in the CONFIG.SYS file. If the menu item is selected from the startup menu, MS-DOS carries out the commands in the associated configuration block, as well as any commands at the beginning of the CONFIG.SYS file and any commands in configuration blocks with the [common] header.

If MS-DOS cannot find a block with the specified name, the item does not appear on the startup menu. The block name can be up to 70 characters long and can contain most printable characters. It cannot include spaces, backslashes ( \ ), forward slashes ( / ), commas, semicolons ( ; ), equal signs ( = ), or square brackets ([ and ]).

menu_text : Specifies the text you want MS-DOS to display for this menu item. If you don't specify any menu text, MS-DOS displays the block name as the menu item. The menu text can be up to 70 characters long and can contain any characters you want.

The MENUITEM command is one of six special CONFIG.SYS commands for defining startup menus and multiple configurations. The other menu-definition commands are:

  • The <MENUDEFAULT> command, which specifies the default menu item.
  • The <MENUCOLOR> command, which defines the color of the menu's text and screen background.
  • The <SUBMENU> command, which defines a submenu.
  • The <NUMLOCK> command, which specifies the state of the NUM LOCK key when the startup menu appears. (Although NUMLOCK can be used anywhere in the CONFIG.SYS file, it is especially useful when defining a startup menu.)
  • The <INCLUDE> command, which includes the contents of one configuration block in another. This command cannot be included in a menu block.

Defines an item on a startup menu that, when selected, displays another set of choices. You can use this command only within a menu block in your CONFIG.SYS file.

The startup menu is a list of choices that appears when you start your computer. You define a startup menu by using special CONFIG.SYS commands.

Each item on the menu corresponds to a set of CONFIG.SYS commands called a “configuration block.” A startup menu makes it possible to start your computer with a variety of configurations.

Syntax

SUBMENU=blockname[,menu_text]

Parameters

blockname : Specifies the name of the associated menu block. The menu block must be defined elsewhere in the CONFIG.SYS file and can contain menu-definition commands. Unlike the “main” menu block, which must have the block name [MENU], a menu block for a submenu can have any name you want. If MS-DOS cannot find a block with the specified name, the item does not appear on the startup menu. The block name can be up to 70 characters long and can contain most printable characters. It cannot include spaces, backslashes ( \ ) and forward slashes ( / ), commas, semicolons ( ; ), equal signs ( = ), and square brackets ([ and ]).

menu_text : Specifies the text you want MS-DOS to display for this menu item. If you don't specify any menu text, MS-DOS displays the block name as the menu item. The menu text can be up to 70 characters long and can contain any characters you want.

The SUBMENU command is one of six special CONFIG.SYS commands for defining startup menus. The other commands are:

  • The <MENUITEM> command, which defines an item on the menu.
  • The <MENUDEFAULT> command, which specifies the default menu item.
  • The <MENUCOLOR> command, which defines the color of the menu's text and screen background.
  • The <NUMLOCK> command, which specifies the state of the NUM LOCK key when the startup menu appears. (Although NUMLOCK can be used anywhere in the CONFIG.SYS file, it is especially useful when defining a startup menu.)
  • The <INCLUDE> command, which includes the contents of one configuration block in another. This command cannot be included in a menu block.

Multiple Configurations : Examples

Defining multiple configurations in your CONFIG.SYS file

The following CONFIG.SYS file defines two configurations:

[Menu]
menuitem=Steve
menuitem=Lisa
 
[Common]
dos=high
buffers=15
device=c:\dos\himem.sys
 
[Steve]
files=20
device=c:dos\emm386 2048
 
[Lisa]
files=40
device=c:\net\network.sys
 
[Common]

This CONFIG.SYS file configures the computer for either Steve or Lisa. For both configurations, MS-DOS carries out the three commands in the first [common] section: DOS=HIGH, BUFFERS=15, and DEVICE=C:\DOS\HIMEM.SYS. Steve uses a desktop publishing program that requires expanded memory, so his configuration includes a command for EMM386. He does not use the network.

Lisa uses the network but not desktop publishing. Her configuration starts the network driver.

Defining multiple configurations in your AUTOEXEC.BAT file

When a configuration is selected from the startup menu, MS-DOS defines an environment variable named CONFIG and sets it to the name of the selected configuration block. In the AUTOEXEC.BAT file, you can use the <GOTO> command to have MS-DOS carry out different sets of commands for different CONFIG values.

The following AUTOEXEC.BAT file uses the GOTO command with the CONFIG variable to carry out different sets of commands. This AUTOEXEC.BAT file is designed to work with the sample CONFIG.SYS file in the preceding section.

c:\dos\smartdrv.exe
set temp=c:\temp
c:\dos\msav
 
; Go to the section that matches the current
; value of the CONFIG variable
goto %config%

:Steve
path=c:\dos;c:\deskpub;c:\typeset
c:\mouse\mouse.com
deskpub
; now skip Lisa's section & go to end
goto end
 
:Lisa
path=c:\dos;c:\network;c:\utility
doskey
net logon lisa
goto end
 
:end

When MS-DOS runs this AUTOEXEC.BAT file, it starts SMARTDrive, sets the TEMP environment variable, and starts the MS-DOS Anti-Virus program. MS-DOS then goes to the section that matches the value of the CONFIG variable.

If the name of the selected configuration is “Steve,” MS-DOS goes to the Steve section. It then sets the search path for Steve, loads the MOUSE.COM program from the C:\MOUSE directory, and runs the desktop publishing program. The GOTO END command instructs MS-DOS to skip to the End section; this prevents the commands in the Lisa section from being carried out for Steve's configuration.

If the current configuration is “Lisa,” the search path is set differently, MS-DOS runs the Doskey program, and a Logon command instructs the network driver (loaded from the CONFIG.SYS file) to connect the computer to the network.

1)
a name surrounded by square brackets
back2root/ibm-pc-ms-dos/ms-dos/6-22-multi-config.txt · Dernière modification : 2024/08/28 13:59 de frater