Classic Computer Magazine Archive COMPUTE! ISSUE 153 / JUNE 1993 / PAGE 58

DOS 6's multiConfig. (Column)
by Mark Minasi

DOS 6 will be out by the time that you read this. That means that I can finally tell you about it. And you know what's probably the best part of DOS 6, at least for techies? MultiConfig.

I mean it. I have one computer that has ten different sets of CONFIG.SYS/AUTOEXEC.BAT files--one for normal DOS work, one for remote access, one for playing around with the CD-ROM, and one for when I attach the Bernoulli Box and do backups.

How often do you find yourself having to set up a plain-vanilla AUTOEXEC.BAT/CONFIG.SYS combination to make some kind of program happy? Or rooting around for a bootable floppy because a CONFIG.SYS experiment went awry and your system won't boot from the hard disk? One of the great annoyances of the world (like having to floss your teeth or do the dishes) is juggling configurations. MultiConfig solves all that.

Here are the highlights. First, MultiConfig allows you to merge together many CONFIG.SYS/AUTOEXEC.BAT combinations into one big CONFIG.SYS/AUTOEXEC.BAT. Second, it adds a simple front-end menu system to those multiple configurations, allowing you at runtime to decide which configuration is right for your work today. And third, it allows you to designate a particular configuration as the default configuration that loads after waiting a specified number of seconds. This month, I'll show you how to do all three with a simple MultiConfig example.

Getting Started

For my example, I'll use another DOS 6 feature, interlnk. DOS 6 includes a serial a parallel port-based file transfer program much like LapLink, called interlnk. Setting up Interlnk involves two parts: a device driver called INTERLNK.EXE and a TSR called either INTERSVR.EXE or INTERLNK.EXE, depending on whether your PC will be acting as a server (INTERSVR.EXE) or a client (INTERLNK.EXE). I don't want to explain interlnk in detail--you don't need to know the details in order to follow this example--but I want to show you how to set up a PC to be able to act as an Interlnk client sometimes. Suppose you have this basic CONFIG.SYS. FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH To make your PC able to act as an Interlnk client or server, you have to add the INTERLNK.EXE device driver. On the days when you want to work with Interlnk, you'll need a CONFIG.SYS that looks like this. FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH DEVICE=C:\DOS\INTERLNK.EXE Basically, you have two CONFIG.SYS files--one that you use for normal operations, and one that you use for Interlnk operations. Let's call them that for convenience's sake: the normal and interlnk configurations.

There are several steps to MultiConfig-ing these files; let's take it one step at a time.

Merging CONFIG.SYS Files

With MultiConfig, you put both CONFIG.SYS files into the same ASCII text file. (I say both, but if you have almost a dozen configurations--as I do--then the better phrase is all configurations.) Don't name it CONFIG.SYS just yet, as it's still going to need some work. For now, call it CONFIG.ALL.

The configurations will be separated with MultiConfig commands, so leave a blank space or two in the file between each configuration. At this point, my CONFIG.ALL looks like this. FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH DEVICE=C:\DOS\INTERLNK.EXE

Naming the Configurations

MultiConfig separates the commands that are to be executed as CONFIG.SYS statements from the commands that are to be MultiConfig commands by requiring MultiConfig commands to be enclosed in square brackets. The first MultiConfig statements to add are the identifiers for these two configurations.

You can call these configurations anything that you like, so let's keep calling them normal and interlnk. Just put those names in square brackets above each configuration. Your CONFIG.ALL will then look like this. [normal] FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH [interlnk] FILES=60 BUFFERS=30 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH DEVICE=C:\DOS\INTERLNK.EXE Just for convenience's sake, let's call each group of lines, headed by a line in square brackets, a block. This CONFIG.SYS contains a block called [norma] and a block called [interlnk].

If you were to attempt to boot using this file as your CONFIG.SYS, DOS would treat this CONFIG.SYS as if it were blank. None of the commands would execute. MultiConfig would recognize two configurations called normal and interlnk, but there would be no MultiConfig statements actually telling DOS to use either of these configurations.

Setting Up the Menu

Most of the directives to MultiConfig go in a block called [menu]. In the [menu] block, you list the alternative configurations and tell MultiConfig what the menu should look like, which options it should take as defaults, how long to wait for a user response, and even what color to put on the screen! Just for starters, we'll list the configurations. You do that with the MENUITEM command. It looks like this: MENUITEM configuration-name, menutext. Configuration-name is the name in brackets at the top of a configuration--normal or interlnk in our example--and menutext is the English text that MultiConfig should display when showing the menu. Add the [menu] block, and CONFIG.ALL looks like this, [menu] MENUITEM normal, Standard setup MENUITEM interlnk, Setup with interlnk driver [normal] FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH [interlnk] FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH DEVICE=C:\DOS\INTERLNK.EXE Now, you can copy CONFIG.ALL to C:\CONFIG.SYS and reboot. You'll see the Starting MS-DOS ... message (a message always seen in DOS 6 when booting), and after two seconds you'll see a screen containing a menu like this.

MS-DOS 6 Startup Menu

1. Standard setup

2. Setup with Interlnk driver Enter a choice: 1 Press 1 and the Enter key, and the system will boot with the normal setting. If you reboot and press 2 this time, you'll see the Interlnk driver load. Take a bow; you've built your first MultiConfig menu!

Adding Defaults and Timeouts

It would be a pain to have to hover over the PC every time it boots, pressing 1 to start up the standard setup and 2 now and then when you need Interlnk. It would be preferable to be able to tell MultiConfig, "If I don't press any keys for two seconds, assume that I want the normal configuration." You can do that with the MENUDEFAULT command. It looks like this: MENUDEFAULT configurationname, timeout.

In this command, the configurationname is the same thing as it was in the MENUITEM command--the name surrounded by square brackets that precedes the block of CONFIG.SYS statements that define a configuration. In our example, you could specify either normal or interlnk. You can optionally add a number to define a timeout, the maximum number of seconds for MultiConfig to wait before taking the default. I'd like to tell MultiConfig to give me two seconds to make a choice, and if I don't make a choice within two seconds, then just to load and use the normal configuration. I can do that by adding this line to the [menu] block of CONFIG.SYS: MENUDEFAULT normal,2. It can go anywhere in the [menu] block. Now, my CONFIG.SYS looks like this. [menu] MENUITEM normal, Standard setup MENUITEM interlink, Setup with Interlnk driver MENUDEFAULT normal, 2 [normal] FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH [interlnk] FILES=60 BUFFERS=30 STACKS=9,256 DEVICE=C:\DOS\HIMEM.SYS DOS=HIGH DEVICE=C:\DOS\INTERLNK.EXE Try booting the system, and keep your hands off the keyboard. You'll see MultiConfig count down and load the normal configuration. Try booting again, and press 2; you'll see that it overrides the default, loading the Interlnk driver.

Now that you have a basic menu system in place, try adding a third or fourth option. By then, you'll notice that there's a lot of redundancy in this system.

Next month, you'll learn how to fix that, as well as how to add a bit of color.