Classic Computer Magazine Archive COMPUTE! ISSUE 155 / AUGUST 1993 / PAGE 58

DOS 6's MultiConfig, part 2. (operating system feature allows users to unify CONFIG.SYS and AUTOEXEC.BAT files) (Column)
by Mark Minasi

In the June issue, I started looking into MultiConfig, the new DOS 6 feature that allows you to unify your scattered CONFIG.SYS/AUTOEXEC.BAT files. This month, we'll look further into MultiConfig's many capabilities.

If you have a color monitor, you can customize the colors of your MultiConfig menu with the Menucolor command. It looks like this: menucolor foreground, [background].

Foreground and background are numbers representing the colors that the PC text screen can display--there are 16 of them. Foreground is a mandatory value, but background is optional. If you don't specify a number, then you just get the normal black background.

I guess what troubles me about this command is the wasted time it causes. If you remove all the combinations where the foreground equals the background, there are still 240 different foreground/background combinations. Experience has shown me that there are a fair number of people who won't rest until they've seen them all.

So far, we've merged only one of DOS's startup files. Now that you've merged two different CONFIG.SYS files into one using Multiconfig, complete with a startup menu, defaults, timeouts, and even colors, it's time to see what MultiConfig does for your AUTOEXEC.BAT. And the answer is, "not much."

There is, however, enough in the way of tools to allow you to link CONFIG.SYS configurations to AUTOEXEC.BAT configurations. Here's how.

Let's return to the two-configuration approach we established in June. Suppose there are two AUTOEXEC.BATs, one for the normal configuration and another for the interlink configuration. The normal AUTOEXEC.BAT might look like this. [at] ECHO OFF PROMPT $P$G PATH C\DOS DOSKEY

The interlink AUTOEXEC.BAT might look like this. [at] ECHO OFF PATH C-\DOS INTERSVR

I want to explain this so both batch veterans and beginners can use this information, so let me first show the people who are comfortable with batch language programming how to put these AUTOEXEC.BATs together into one AUTOEXEC.BAT. Then I'll present a step-by-step formula for combining batch files that anyone who can use an editor can follow.

The key to being able to combine two (or more) AUTOEXEC.BATs into a single batch file and then extract them as they were originally is an environment variable called CONFIG. It contains the name of the configuration that you selected--in our example, that means either normal or interlink. You then use "IF . . . ==" commands and GOTOs to control which part of the AUTOEXEC.BAT file is executed. Here's what it would look like for our example AUTOEXEC.BAT situation. [at] ECHO OFF IF %config%==normal GOTO

normal IF %config%==interlink GOTO

interlirk :normal PROMPT $P$G PATH C:\DOS DOSKEY GOTO end :interlink PATH C:\DOS INTERSVR GOTO end :end

Batch experts may look upon my approach in the previous example as being a trifle inefficient, but it follows a nice, simple formula that anyone can use to quickly combine a number of configurations into a single AUTOEXEC.BAT. Let's see how to use that formula to assemble different AUTOEXEC.BATS into a single file. If we have three AUTOEXEC.BAT configurations that are named c1, c2, and c3, we could build our AUTOEXEC.BAT like this. [at] ECHO OFF IF %config%==c1 GOTO c1 IF %config%==c2 GOTO c2 IF %config%==c3 GOTO c3 :c1 [put the c1 commands here] GOTO end :c2 [put the c2 commands here] GOTO end :c3 [put the c3 commands here] GOTO end :end

This skeleton of a batch file is intended to underscore how to build an AUTOEXEC.BAT that supports three configurations. You can easily see how to extend it to four, five, or any number of configurations.

It may be obvious, but I'll mention anyway that the lines in brackets shouldn't be typed literally; they're intended to be instructions to you, not to be typed to the PC.

Perhaps even more generally, you can assemble a combined AUTOEXEC.BAT using this step-by-step method.

Step 1: The first line of your combined AUTOEXEC.BAT should be an [at] ECHO OFF.

Step 2: Examine your CONFIG.SYS's [menu] section that you assembled previously and write down the names of all the configurations. Take the name of the first configuration and incorporate it into an if statement that looks like this: IF %config%==[name of configuration] GOTO [name of configuration].

You should replace [name of configuration] with the actual name of the first configuration. Do that for each configuration name. For example, suppose you find that your CONFIG.SYS has a menu section that looks like this. [menu] menuitem standard, Normal

stuff I use menuitem maxmemory, Set up

to give maximum free

memory menuitem wingcomm, Configuration

to run Wing Commander II menudefault . . .

That means that you have three configurations named standard, maxmemory, and wingcomm. (Notice that I didn't include the normal and interlink configurations. I didn't want you to start thinking that they were mandatory.) You'd prepare the first configuration IF to look like this: IF %config%==standard GOTO standard.

Notice that the ==standard is in lowercase. The case in the IF statement must match the case of the named configuration, or this just plain won't work.

You'd then assemble the other IF statements, one for each of the two other configurations, and you'd have an AUTOEXEC.BAT that looks like this. [at] ECHO OFF IF %config%==standard GOTO standard IF %config%==maxmemory GOTO maxmemory IF %config%==wingcomm GOTO wingcomm

Step 3: Create a section of the AUTOEXEC.BAT for each of the configurations. Each section should have two lines. The first line is the name of the configuration preceded by a colon, and the second line should say GOTO end, The last line in the batch file should say :end. If you do that, your AUTOEXEC.BAT will look like this. [at] ECHO OFF IF %config%==standard GOTO

standard IF %config%==maxmemory GOTO

maxmemory IF %config%==wingcomm GOTO

wingcomm :wingcomm GOTO end :maxmemory GOTO end :standard GOTO end :end

Step 4: For each section, insert the AUTOEXEC.BAT for that section between the label with the colon at the beginning of it and the GOTO end. Save this file, and you're done.

To put it all together, let's suppose the AUTOEXEC.BAT for the standard configuration looks like this. PROMPT $P$G PATH C:\DOS DOSKEY PRINT /Q SMARTDRV

The configuration for maxmemory looks like this. PROMPT $P$G PATH C:\DOS LH DOSKEY

And the configuration for wingcomm looks like this. CD\GAMES\WC2 WC2

You'd insert these files into the AUTOEXEC.BAT that you're building, and your final AUTOEXEC.BAT would look like this. [at] ECHO OFF IF %config%==standard GOTO

standard IF %config%==maxmemory GOTO

maxmemory IF %config%==wingcomm GOTO

wingcomm :standard PROMPT $P$G PATH C:\DOS DOSKEY PRINT /Q SMARTDRV GOTO end :maxmemory PROMPT $P$G PATH C:\DOS LH DOSKEY GOTO end :wingcomm CD\GAMES\WC2 WC2 GOTO end :end

There you have it--a quick and painless way to integrate your configurations under DOS 6.

Speak Up!

Do you have a tough hardware problem you'd like Mark to tackle? Let him know about it by calling (900) 884-8681, extension 7010202. The call will cost 95 cents per minute, you must be 18 or older, and you must use a touch-tone phone. Sponsored by Pure Entertainment, P.O. Box 186, Hollywood, California 90078.