Д Area: Batch file programming (Fido) ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
  Msg#: 99                                           Date: 11 Jul 95  15:50:32
  From: Matthew Lewis                                Read: Yes    Replied: No 
    To: Rick Viscusi                                 Mark:                     
  Subj: Multi-Config  (Part 1)
ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
@MSGID: 1:134/32 30029de3
@REPLY: 1:267/161.0 30019f73
@PID: GED G0615
 Hello Rick,

At 17:45, 10 Jul 95, Rick Viscusi wrote to Matthew Lewis:

ML>> when using the DOS 6+ multi-config option,

RV>     Multi-config, what is this all about?

Multi-config setups are nothing new to many denizens of BATPOWER, and others
who play with the setup of their computers.

Prior to the release of MS-DOS version 6.0, it was most often done with a batch
file that would copy alternate Autoexec.Bat and Config.Sys files to the root
directory of the boot drive, or by booting from a floppy disk set up for a
particular configuration.

With the release of MS-DOS 6.0, Microsoft included a new feature, which some,
including myself, feel is one of their brighter ideas.

This feature allows you to include a MENU in your Config.Sys file, which will
allow you up to 9 choices of how you want to boot the system.  Any of these 9
can also be a SUBMENU offering another 9 choices.  A SUBMENU can also have more
SUBMENUs.

I don't know if there's a limit to how many levels deep you can go with these
SUBMENUs, but I've successfully gone 5 levels deep with no problems while just
playing with it to see what could be done.

The possibilities are limited only by your imagination.

Indeed, one of Microsoft's brighter ideas.

Here's how it works, showing some examples from my own configuration for the
machine I'm using at the moment.  They're totally different on each of my
computers.

Here are the first few lines of my Config.Sys file:

        [MENU]
        MENUCOLOR=14,4
        MENUITEM=Bbs, Flossie's Saloon {2}
        SUBMENU=Links, LINKS Golf
        MENUITEM=Win, Microsloth Windoze 3.1
        SUBMENU=MS-DOS, MS-DOS 6.20
        MENUITEM=Test, System Test & Maintenance
        MENUDEFAULT=Bbs, 15

That first line tells DOS that this is a menu.  You can have only one "[MENU]"
line in Config.Sys, and though not certain, I believe it must be the very first
line.

Next, MENUCOLOR sets the colors (logical)  14,4 gives me bright yellow text on
a red background.  This immediately gets my attention, and I find it easy to
read.  You can use any color combination that looks good to you.  This line is
optional.

The next 5 lines (MENUITEM & SUBMENU) are the choices what will appear on the
screen.  The part after the equals sign and before the comma, is the actual
name of that configuration or submenu.  It's also known as a block name.  More
on "Blocks" later.  The part after the comma is the text that will appear on
the screen.  I believe it's limited to 60 characters.  You can have up to 9
choices per menu.

The last line above (MENUDEFAULT) is optional.  If used, that menu choice will
be highlighted.  If not used, the first choice will be highlighted.  The comma
and following number are optional.  If used, that choice will automatically be
selected after that number of seconds.  If a zero is used, that choice will
immediately be selected, and you won't even see the menu.

When the system boots, the menu will be displayed.  If a time was specified on
the MENUDEFAULT line, you'll see a countdown timer.

At this point, hitting the Enter key will select the highlighted item, which is
the default.  If you want a different choice, just move the highlight bar with
the up/down arrow keys, or type its number, and hit Enter to select it.

Ok, I guess it's time to explain "Blocks" now.

You build your Config.Sys file with "Blocks."  Any line enclosed in square
brackets is a "Blockname" and all lines below it, until the next "Blockname"
are a part of that "Block."  Simple, eh?

Blocknames are like labels in a batch file.  When you select a choice from the
menu, Config.Sys branches (jumps) to that Block, and executes those lines.  It
also sets the environment variable CONFIG to that Blockname.  This comes in
very handy later on, when we get into Autoexec.Bat.

I'm starting to go a bit long here, so I'll continue in "Part 2" of this
message.

Wouldn't want to exceed the dreaded 99 line limit of some older readers.

                                Matthew.....

-!-
 ! Origin: Flossie's Saloon & BFDS Site * Calgary * 1-403-262-5998 (1:134/32)
SEEN-BY: 134/1 2 14 17 32 40 42 85 143 146 207 211 202/203 300 406 701 777
SEEN-BY: 202/800 900 1112 1206 1207 1301 1601 1709 396/1 3417/2 3615/50 51
@PATH: 134/32 17 3615/50 202/777 1207


Д Area: Batch file programming (Fido) ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
  Msg#: 100                                          Date: 11 Jul 95  15:51:06
  From: Matthew Lewis                                Read: Yes    Replied: No 
    To: Rick Viscusi                                 Mark:                     
  Subj: Multi-Config  (Part 2)
ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
@MSGID: 1:134/32 3002a76f
@REPLY: 1:267/161.0 30019f73
@PID: GED G0615
 Hello Rick,

Continuing from where I left off in Part 1 of this message.

Here's my [Links] block:

        [Links]
        MENUITEM=Lj, Play with Joystick
        MENUITEM=Lm, Play with Mouse
        SUBMENU=MENU, Return to Main Menu
        MENUDEFAULT=Lm

I've got 3 choices on this SUBMENU.  The third is one I've not seen documented
anywhere, but decided to try several months ago, as the structure of the main
menu and submenus are the same.  Sure enough, it worked, and I've been using it
ever since as a convenient "Bail-Out" which takes me back to the very top
should I decide I didn't really want to do that anyway.

Note there's no time specified on the MENUDEFAULT line.  That feature doesn't
work in submenus, but it will still highlight the default, so pressing the
Enter key will still select it.

"Play with Mouse" is now highlighted, but I want to use the joystick instead,
so I either type a "1" or hit the up arrow key to select the first choice, and
then hit the Enter key, and it branches to my [Lj] block.

        [Lj]
        DEVICE=C:\DOS\SETVER.EXE
        DEVICE=C:\DOS\HIMEM.SYS
        DEVICE=C:\DOS\RAMDRIVE.SYS 1600 /E
        DEVICE=C:\BIN\TANSI.SYS
        DOS=HIGH
        BUFFERS=40
        FILES=32
        LASTDRIVE=D
        SET CONFIG=Links
        SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:256 /P
        STACKS=0,0

This looks pretty much like a run-of-the-mill Config.Sys file, except for that
"SET" command, doesn't it?

Beginning with MS-DOS version 6.0, you can use the SET command to set
environment variables from Config.Sys rather from a batch file later.

I don't recommend this as a normal practice, as it will cause memory to be
wasted later on, but Config.Sys has already set the CONFIG variable to "[Lj]"
so I'm only adding 3 bytes here, and it will save me some work later on.

If I had selected to play with the mouse instead of the joystick, the SUBMENU
would have branched to my [Lm] block instead.

        [Lm]
        INCLUDE=Lj
        DEVICE=C:\BIN\MOUSE.SYS /3K /BHIGH /S02 /DLEFT /CENHANCE /COFF /1

That INCLUDE command can save you a lot of typing.  This block executes all the
commands in my [Lj] block, and loads my mouse driver, which is the only
difference between the two configurations.

Whoever came up with the idea for Microsoft's Multi-Config is starting to sound
even brighter now.  Pity they don't have a few more like him.

Finally, after several more "Blocks" we get down to the bottom of the
Config.Sys file, where we find:

        [COMMON]
        NUMLOCK=OFF

Any commands in the [COMMON] block will be included every time you boot.

That's the only command I use in ALL of my configurations, but you can include
as many as you wish to, or even leave this block out if you have no common
commands.

That's pretty well all there is to setting up a Multi-Config Config.Sys file.

All the details, and several examples can easily be found by going to your DOS
prompt and typing:

        HELP MULTI-CONFIG

This will even give you more information than the printed manual.

Looks like I better start a "Part 3" to explain the various options available
in Autoexec.Bat, though some readers will have already figured that out on
their own.  I've given them sufficient clues.

                                Matthew.....

-!-
 ! Origin: Flossie's Saloon & BFDS Site * Calgary * 1-403-262-5998 (1:134/32)
SEEN-BY: 134/1 2 14 17 32 40 42 85 143 146 207 211 202/203 300 406 701 777
SEEN-BY: 202/800 900 1112 1206 1207 1301 1601 1709 396/1 3417/2 3615/50 51
@PATH: 134/32 17 3615/50 202/777 1207


Д Area: Batch file programming (Fido) ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
  Msg#: 101                                          Date: 11 Jul 95  16:31:44
  From: Matthew Lewis                                Read: Yes    Replied: No 
    To: Rick Viscusi                                 Mark:                     
  Subj: Multi-Config  (Part 3)
ДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДДД
@MSGID: 1:134/32 3002b2c3
@REPLY: 1:267/161.0 30019f73
@PID: GED G0615
 Hello Rick,

Continuing from Part 2 (this should finish it) ...

Now that we're done with Config.Sys, it's on to Autoexec.Bat, a subject
slightly more "On-Topic" for the echo.     ;-)

Remember those "Blocknames" we used in Config.Sys ?

The one we chose to boot with is now available to us as the CONFIG environment
variable, unless we changed that variable with a SET command in Config.Sys.

This gives a lot of decision making power in Autoexec.Bat.

Microsoft suggests using the IF command, and/or the GOTO command with labels
having the same names as your Blocknames.

Any place in a batch file where you use the string "%CONFIG%" (without the
quotes)  DOS will substitute the contents of the CONFIG variable, which is your
Blockname, unless you changed it.

You could use commands like these:

        If %CONFIG% == Win C:\Dos\Smartdrv
        If not %CONFIG% == Win d:\path\load some other cache
        and so on ...

Or do it this way:

        This gets done on every boot
        That gets done on every boot too
        Some other thing gets done all the time as well
        GOTO %CONFIG%
        :Win
        rem     do all your Windows setup stuff here
        win
        goto end
        :WP
        rem     setup WordPerfect here
        wp
        goto end
        :Links
        rem     off to the golf course
        goto end
        :BBS
        rem     do setup
        bbs.bat
        :Test
        rem     setup Test configuration here
        :end

Note that I didn't include a "goto end" after starting the BBS.  If the command
you use to start a program is another batch file, you don't need it.

If, on the other hand, I had left out the "goto end" commands below the :Win,
:WP, and :Links labels, and booted up to run Windows, when I exited Windows, it
would load WordPerfect, followed by Links, and finally try to run the BBS.

Well, I went and figured out yet another way that Microsoft didn't suggest.

Create a separate "Autoexec.Bat" for each of your configuration options, but
give them names the same as your Blocknames, like Win.Bat, BBS,Bat, Links.Bat,
and so on.  Keep the root directory a bit cleaner by putting them all in a
subdirectory (C:\BOOT is a logical choice) then you can have an Autoexec.Bat
file in the root directory with the single line:

        @C:\Boot\%CONFIG%

I've done it this way (almost).  There are a few things I want to do EVERY time
I boot, so I put those commands in my Autoexec.Bat file, which uses the above
line as its last line.

There's nothing difficult at all about this Multi-Config thing, but it does
require a bit of work on your part to put it all together.

I happen to feel it's worth the extra work, as it allows me to boot up with a
configuration that's optimized for whatever application I want to run at the
time.

It's not for everyone, but for those who take the time to set it up, it can
make life with a computer much friendlier.

A final note about "Blocknames."  They can be up to 70 characters long, but if
you want to use them later as labels, only the first 8 characters are
significant (first 40 for 4DOS or NDOS).

If you want to use them later as filenames, the maximum is 8 characters.

And a final, final note, on Config.Sys.  It seems that the [MENU] line does NOT
need to be the first line in Config.Sys, but anything above it will be executed
with every boot.  (read through the help file again)

                                Matthew.....

-!-
 ! Origin: Flossie's Saloon & BFDS Site * Calgary * 1-403-262-5998 (1:134/32)
SEEN-BY: 134/1 2 14 17 32 40 42 85 143 146 207 211 202/203 300 406 701 777
SEEN-BY: 202/800 900 1112 1206 1207 1301 1601 1709 396/1 3417/2 3615/50 51
@PATH: 134/32 17 3615/50 202/777 1207