• Aucun résultat trouvé

Using Multiple Configurations

A single CONFIG.SYS file can define several different system configurations. This can be useful if several people share a single computer, or if you want to be able to start your computer with a choice of configurations.

Each step in defining how you would type multiple configuration commands in your CONFIG.SYS file is explained.

Step 1: Defining a Startup Menu

To use multiple configurations, you must define a startup menu. To do this, create a configuration block with the block heading [Menu]. A menu block can contain any of the following commands:

The MENU ITEM command The MENUDEFAUL T command The MENUCOLOR command The SUBMENU command

When your computer starts, the startup menu appears and lists the available configurations; you choose the configuration you want.

If you type this in your CONFIG.SYS file: DOS produces this startup menu:

IBM DOS Startup Menu

=======================

[MENU]

menuitem=DLS, Load DOS LAN Services Client 1. Load DOS LAN Services Client menuitem=INTLNK, Load InterLnk Client 2. Load InterLnk Client

menuitem=CPSW, Load Code Page switching 3. Load Code Page Switching menucolor=7,l

menudefault=DLS,2

In this example:

Enter a choice: 1 Time remaining: 2

The MENUITEM command defines the item on the menu. The first MENUITEM command value, [DLS], specifies the name of the associated configuration block. The second value, which is optional, specifies the text, Load DOS LAN Services Client to display on the menu. If you do not specify any menu text, DOS uses the name of the configuration block as the menu text.

The MENUCOLOR command sets the text color to 7 (white) and the background color to 1 (royal blue).

The MENUDEFAUL T command is optional. When this command is used, it specifies which menu item is to be the default configuration. The block must be defined elsewhere in the CONFIG.SYS file. When DOS displays the startup menu, the default menu item is highlighted, and its number appears after the Enter a choice prompt. If no item is specified, the default is set to the first item.

The MENUDEFAULT command also sets a timeout value. You can specify a timeout value from 0 to 90 seconds. A timeout of 0 seconds forces automatic selection of the default, effectively bypassing the menu display.

If you specify a timeout value but no item is selected within the specified time, DOS starts the computer with the default configuration.

If you do not specify a timeout value, DOS does not continue until the ENTER key is pressed.

Step 2: Defining Configuration Blocks

A configuration block is a set of CONFIG.SYS commands that you want DOS to run when that particular configuration is selected from the startup menu. A

configuration block begins with a block header-the block name surrounded by brackets. The block name must be a single word but can be as long as you want.

When DOS starts with a particular configuration, it carries out all the commands between that block header and the next block header.

A configuration block can contain any command you would normally place in your CONFIG.SYS file. A CONFIG.SYS file can define a [Common] block that includes commands common to all configurations. DOS carries out the command in a [Common] block for every configuration. You can have as many [Common] blocks as you want; DOS runs [Common] commands in the order in which they appear in the CONFIG.SYS file.

The following CONFIG.SYS file defines two configurations and includes several commands that are common to both:

CONFIG.SYS file (continued)

[COMMON]

files=3 buffers=3 lastdrive=z break=on

device= C:\DOS\HIMEM.SYS dos=HIGH,UMB

device=C:\DOS\EMM386.EXE NOEMS device=C:\DOS\SETVER.EXE

[CPSW]

country= 1, ,C:\DOS\COUNTRY.SYS

devicehigh=C:\DOS\display.sys con=(ega, ,1) [DLS]

devicehigh=C:\NET\protman.dos /i:C:\NET devicehigh=C:\NET\dlshelp.sys

devicehigh=C:\NET\ibmtok.dos [ INTLNK]

devicehigh=C:\DOS\INTERLNK.EXE [COMMON]

devicehigh=C:\DOS\ANSI.SYS

shell=C:\DOS\COMMAND.COM /P /E:512

This CONFIG.SYS file configures the computer for LAN networking [DLS], laptop computer connectivity [INTLNK], and code page switching and keyboard support [CPSW]. For all three configurations, DOS runs the commands in the [Common]

configuration blocks.

Chapter 2. Configuring Your System 41

The INTLNK configuration uses the Client Device Driver (INTERLNK.EXE) to make the client computer use devices on the server computer as though they were local drives. INTERLNK loads itself into upper memory when upper memory blocks are available. The [Common] section makes these upper memory blocks available.

Step 3: USing INCLUDE statements for Multiple Configurations

The CONFIG.SYS file can also contain the INCLUDE command.: You can include the contents of one configuration block in another by using the INCLUDE command.

The INCLUDE'command instructs DOS to carry out the commands in another configuration block as well as the commands in the current block. This command specifies the name of the block you want to include; the command can be used only within a configuration block.

Suppose you wanted to add another configuration that includes all three of the previously discussed configuration blocks combined. You could use the INCLUDE command to do this by adding a fourth configuration similar to the following:

CONFIG.SYS file (continued)

[LOADALL]

include=CPSW include=DLS include=INTLNK

set path=c:\net;c:\dos

[Cornman]

The [LOADALL] configuration ,uses the INCLUDE command to include the [CPSW], [DLS], and [INTLNK] blocks. It also has its own SET PATH command.

It is a good idea to place a [Common] block at the end of your CONFIG.SYS file, even if it does not contain any commands. Some applications append commands to your CONFIG.SYS file. If your CONFIG.SYS file has a [Common] block at the end, an application can append commands to the CONFIG.SYS, and DOS will carry out those commands for all your configurations.

Step 4: Modifying the AUTOEXEC.BA T File for Multiple Configurations When using multiple configurations, it can be useful to have DOS run different AUTOEXEC.BAT commands for each configuration. You can create branching code in the AUTOEXEC.BAT file by using batch commands such as the IF and

GOTO commands. With batch commands, you can have DOS carry out different AUTOEXEC.BAT commands depending on the startup configuration.

When a configuration is selected from the startup menu, DOS sets the CONFIG

The following AUTOEXEC.BAT file tests the CON FIG variable and executes different commands depending on the result; it is designed to work with the

When DOS runs this AUTOEXEC.BAT file, it sets the path, prompt style, and the TEMP environment variable.

DOS then tests the value of the CONFIG variable. The CONFIG.SYS value was set when you entered your choice of configuration from the Startup Menu.

For example, if the name of the current configuration is not CPSW, DOS inquires whether you want mouse support. If you do not want to load the mouse or you do not make a choice of whether to load the mouse in three seconds, mouse support is not loaded.

Whether or not you choose to have mouse support, this configuration then runs the DOSKey program, starts the IBM AntiVirus/DOS, and starts the DOS Shell program.

Documents relatifs