Index | Overview CONFIG.SYS Commands



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.
-Top- | Overview CONFIG.SYS Commands