ChgBoot: Change Boot-Up Configuration v1.0 Released August 29, 1991 Written by S. W. Lange 602 Dusk Ave. Azle, TX 76020 (817) 444-4857 (6:00 - 10:00 p.m. CST) Program and Documentation are Copyright (c) 1991 by S. W. Lange. All rights reserved. Portions Copyright Borland, International. ChgBoot is written using Borland C++. ChgBoot Registration Form: S. W. Lange 602 Dusk Ave. Azle, TX 76020 ChgBoot v1.0 Quantity Price Disk ($15.00/Copy) _______ __________ Total enclosed __________ Please make payment by check or money order (in US funds) payable to 'S. W. Lange'. Please specify the preferred diskette size: ___ 5.25" 360KB ___ 3.50" 720KB Name ________________________________________________________ Company ________________________________________________________ Address ________________________________________________________ ________________________________________________________ Phone ________________________________________________________ Where did you get ChgBoot ____________________________________ ________________________________________________________________ ChgBoot Quick Start In order to begin using ChgBoot as quickly as possible, the following steps should be taken: 1. Ensure that you have a bootable floppy diskette with a copy of your current Autoexec.Bat and Config.Sys files. If you have any trouble implementing different machine configurations using the ChgBoot program, you can reboot using the floppy disk. 2. Rename the Autoexec.Bat and Config.Sys files located in the root directory of the boot-up drive (i.e., C:\) to Autoexec.Cfg and Config.Cfg. 3. Copy the ChgBoot.Exe and QuikStrt.Cfg to the root directory of the boot-up drive. 4. Rename QuikStrt.Cfg to ChgBoot.Cfg. 5. Type ChgBoot. The QuikStrt.Cfg file makes use of the [Include] keyword to include your previous Autoexec.Bat and Config.Sys files. This will allow the ChgBoot program to run with one configuration. More can be added using the configuration format shown in the file Sample.Cfg. Change Boot-Up Configuration Manual I. Introduction The ChgBoot configuration program is used to manage multiple machine configurations automatically. The working parts of the program consist of two files, the executable file ChgBoot.Exe and the configuration file ChgBoot.Cfg. The configuration file contains the multiple boot-up system files as well as program default settings and macro definitions. The program operates by writing selected boot-up files into the root directory and then rebooting the machine. Besides automatically rebooting the machine in a new configuration, the program can also be made to manage the autoexec.bat and config.sys files in other ways. The program makes use of macro definitions within the system configuration files to ease the management of multiple system configurations and allow simpler editing of system configurations. If it is necessary to update a command that is common to a number of system configurations, it is only necessary to define a macro for that command and then modify the macro to update all of the system configurations. Each system configuration may contain a help line that is displayed with the menu item to further describe the configuration. If desired, the hidden or read-only file attribute bits can be set in order to hide the system files or protect them from being erased. The program can also be made to keep a back-up copy of the most recent set of configuration files used. The program can also be driven from the command line, bypassing the menu screen if the user knows which configuration is desired. II. Description Of Operation A. Features 1. Use Of Macros In Configuration File: The program has the ability to use macro definitions in the configuration file to manage text strings that are to be written to the Autoexec.Bat and Config.Sys files. This allows a user to more easily manage multiple machine configurations. 2. Use of Include Directives In Configuration File: The program can be setup to have a single configuration file with all of the boot-up configurations in that file. Or, the configuration file can contain include directives to allow the inclusion of other text files that are to be written out to the appropriate system files as needed. In this way, the user can organize his or her machine configurations in the most desirable way to increase productivity. 3. Run DOS Commands Or Programs Prior To Rebooting: Another feature of the program is the ability to run any DOS commands or programs prior to rebooting the machine. This feature might be used to force a disk cache to be automatically flushed, etc., before reboot. 4. Run ChgBoot From Any Drive Or Directory: By default, the ChgBoot program wants to be run from the root directory of the boot drive. But, the program can be run from another drive or directory and can use another name for the configuration file besides the default name of ChgBoot.Cfg. 5. Default Program Behavior: The default behavior of the ChgBoot program as concerns automatically rebooting, setting or clearing hidden and read-only file attributes, saving a backup copy of the Autoexec.Bat and Config.Sys files, and saving the boot-up configuration information can all be controlled by setting switches within the ChgBoot.Cfg configuration file. 6. User Configurable Menu Lines And Help Lines: Each system configuration in the configuration file ChgBoot.Cfg has a menu title and a help line defined by the user. The menu title can be up to 60 characters long, while the help line can be up to 80 characters long. 7. Controllable Text Indenting In System Files: The program has three indenting modes set from within the ChgBoot.Cfg configuration file. These are no indenting, relative indenting, and absolute indenting. No indenting causes any strings in the configuration file to be written to the system files starting at column 1. Absolute indenting causes the strings in the configuration file to be written to the system files with the exact number of leading spaces that they had in the configuration file. Relative indenting writes the string with the least number of leading spaces at column 1 in the system files, and then the other strings are indented with respect to that string. 8. Use Of Comments In The ChgBoot.Cfg File: The '#' sign defines a comment in the ChgBoot.Cfg configuration file. Any text to the right of a '#' comment sign is ignored by the program. 9. User Defined Editor: The program allows the user to define his or her own editor for use while inside the program to edit the ChgBoot.Cfg configuration file. Once the user has assigned the editor switch in the ChgBoot.Cfg file with the path and name to the desired editor, the program will call the editor and automatically load the ChgBoot.Cfg file into it to allow changes to be made to the configuration file 'on the fly'. 10. Saving Boot Configuration Information: The program can save the current boot-up configuration in one of two ways. A line can be automatically appended to the Autoexec.Bat file when written to set an environment variable that records the current configuration. Or, a one line text file can be written in the same directory as the ChgBoot.Exe file is located that contains the current boot-up configuration. Then, when ChgBoot.Exe is next run, it scans the recorded information and displays it in the menu screen. If If the user does not want the boot-up information recorded, this feature can also be turned off. When set to off, the menu display simply shows a '?' for the current configuration. This behavior is controlled by a switch in the ChgBoot.Cfg configuration file. B. Operation 1. Command Line Description: The command line to invoke the ChgBoot program is as follows: ChgBoot [options] Where options are: /a+ Perform warm boot /a- Do not perform warm boot (default) /f Define ChgBoot.Cfg filename /oX Use configuration option letter 'X' Valid configuration options: 'a' ó X ó 'r' -? Help screen An example command line might be: chgboot /a- /ob /fC:\Util\MyBoot.Cfg Note: Command line options can use either a '/' or a '-' to denote the switch. Command line options are not case sensitive. This command line would write the second set ('b') of system files to the root directory, would not perform a warm boot, and would use the configuration file 'MyBoot.Cfg' found in the \Util directory. Any other options specified in the configuration file would also be used, and last, any remaining unspecified options would use the program defaults. The lettering of the configuration options 'a' - 'r' corresponds to the physical ordering of the individual system files within the configuration file. The first set of system files is 'a', the second 'b', etc. There is a limit of 18 configurations within an individual configuration file. If there is a need for more than this, a second configuration file would have to be written and specified from the command line. Any unrecognized options force a display of the command line help screen. 2. Running ChgBoot From Root Directory: This is the simplest way to set up the program. Both the executable file, ChgBoot.Exe, and the configuration file, ChgBoot.Cfg, are placed in the root directory of the boot-up drive. When run in this manner it is not necessary to specify a configuration file or directory. 3. Running ChgBoot From Another Directory: By default, the program looks for a configuration file name ChgBoot.Cfg in the executable directory where ChgBoot.Exe is found, or in the root directory of the current drive. If the configuration file is not found in either of these two directories, the directory or filename used for the configuration file must be specified. This can be done from the command line or using the CHGBOOT environment variable. Some examples of this are: Set CHGBOOT=C:\Util The above line would normally be placed in the Autoexec.Bat file and signifies that the program should use the default configuration filename 'ChgBoot.Cfg' and that it will be found in the C:\Util directory. This same directory name could be passed in on the command line: chgboot -fc:\util Note that the path can either have a trailing backslash ('\') or not. If the specified filename is not found, it will not search the default directories. An example of using a configuration file with another filename would be: Set CHGBOOT=C:\Util\MyBoot.Cfg Again, if the configuration file uses the default filename 'ChgBoot.Cfg', and it is located in the executable directory or the root directory, then it is not necessary to specify a filename at the command line or in an environment variable. 4. Running ChgBoot From Another Drive If the program is run from a drive other than the boot-up drive, it is also necessary to specify which drive is the boot drive in the configuration file. This is done using the [BootDrv] keyword. If the boot drive were C:, the configuration line would be: [BootDrv]=C: 5. Running Other Programs Before Reboot: In order to run other programs prior to rebooting the machine, it is necessary to use the [RunDos] keyword in the configuration file. An example of this might be: [RunDos]=PC-Cache /Flush This command would cause Central Points Software's PC-Cache (c) to be flushed prior to rebooting the machine. III. Organization Of The ChgBoot.Cfg Configuration File The ChgBoot configuration file has a number of features to help manage having multiple machine configurations. These are: 1. Comments: The comment in the ChgBoot configuration file is denoted by the '#' sign. Any text after the '#' sign is ignored by the program. 2. Program Keywords: The following is a list of valid program keywords in use by the ChgBoot program: [SystemStart] Denotes the start of a new configuration [SystemEnd] Denotes the end of a configuration [MenuTitle] String to be displayed in menu [HelpLine] Help text to be displayed with menu item [MacroStart] Start of macro defines [MacroEnd] End of macro defines [AutoStart] Start of Autoexec.Bat file [AutoEnd] End of Autoexec.Bat file [ConfigStart] Start of Config.Sys file [ConfigEnd] End of Config.Sys file [AutoBoot] Determines whether warm boot is performed [HideFiles] Determines whether to hide system files [RunDos] Run DOS command prior to reboot [BootDrv] Location of boot drive (i.e., 'C:'); [LockFiles] Set read only bit on system files [BackUp] Save back-up of system files [Config] Used to save the boot-up configuration info [Indent] Set system files indent behavior [Editor] Define editor to use when in program [Include] Include a specified text file in either the Autoexec.Bat or Config.Sys when writing them. Note: Except for macro definitions, all keywords and keyword values are case insensitive. This means that the following declarations are legal and identical as far as the program is concerned: [AuTOBOOt]=oN [AutoBoot]=ON [autoboot]=on An explanation of the use of each of the program keywords follows. 3. Defining A System Configuration Block The [SystemStart] and [SystemEnd] keywords define a configuration. Each configuration must have the following keywords defined: [SystemStart] [MenuTitle] [HelpLine] [AutoStart] [AutoEnd] [ConfigStart] [ConfigEnd] [SystemEnd] The [HelpLine] keyword is optional. There must be no keywords other than the [Include] keyword inside the [Auto...] or [Config...] blocks. If they are inside the [Auto...] or [Config...] blocks, the keyword strings would be written into the system files and cause an error at boot-up time. The order of the [MenuTitle] and [HelpLine] keywords are unimportant, as long as they are within the [System...] block. The text associated with a menu title need not be unique, and can be up to 60 characters long. An example would be: [MenuTitle]=Standard Configuration w/DOS Loaded High The text associated with the help line can be up to 80 characters long. An example might be: [HelpLine]=Uses QEMM, SmartDrv Disk Cache, & 2M Byte Ram Disk Whenever the cursor is on the menu title, the help line will be displayed at the bottom of the screen. Macro definitions within menu titles or help text will not be expanded. 4. Defining A Macro Block The [MacroStart] and [MacroEnd] keywords denote a block of macro substitutions that are to be used in the system files. The format of a macro line is as follows: Identifier=Substitution Text An example might be: SHELL=Shell=C:\Dos\Command.Com /P /E:2048 Where: 'SHELL' is the macro identifier 'Shell=C:\Dos\Command.Com /P /E:2048' is the substitution text. The equal sign is used to define the end of the macro identifier. There must be an equal sign present or an error will occur. There should be no whitespace ( or ) before or after the equal sign, or the macro identifier or substitution string will also contain the same whitespace. If an error were made by leaving off the equal sign denoting the end of the macro identifier and the identification string also contained an equal sign, the macros would not be expanded correctly. An example might be: SHELL Shell=C:\Dos\Command.Com /P /E:2048 This string would be incorrectly interpreted as: 'SHELL Shell' is the macro identifier. 'C:\Dos\Command.Com /P /E:2048' is the substitution string. In order to cause the defined macro to be expanded it must be defined in the [Auto...] or [Config...] block as follows: $(SHELL) There should be no comments in a macro definition. There can be multiple sets of [Macro...] blocks, but there is a limit of 256 total macro definitions allowed in the program. Only macros within an [Auto...] or [Config...] block are expanded. There is a limit of 256 characters imposed on the size of the macro string by the ChgBoot program. But, the size of the expanded string written to the autoexec.bat or config.sys file may not exceed the DOS limit of 128 characters. Macro identifiers are case sensitive. 5. Notes About The [Auto...] And [Config...] blocks Any text that is in an [Auto...] or [Config...] block (i.e., between the [AutoStart] and [AutoEnd] or between the [ConfigStart] and [ConfigEnd] keywords) will be be copied verbatim into the appropriate system configuration file. This includes any blank lines. The maximum number of machine configurations is 18. This is the limit on the number of choices that can be displayed by the menu. 6. Controlling Default Program Behavior There are four boolean switches that may be used to control default program behavior. They are: [AutoBoot] [HideFiles] [LockFiles] [BackUp] Each switch may set the option to 'ON' or 'OFF'. Each keyword must be defined outside of any [Auto...] or [Config...] blocks. To stop the program from automatically rebooting the machine after writing the new system files to the root directory, the [AutoBoot] switch would be set: [AutoBoot]=OFF This sets the default behavior of the program. If the [AutoBoot] switch is set to 'ON', then the program performs a warm boot after writing the new configuration files to the root directory. If it is set to 'OFF', then the program only writes the new files to the root directory, it does not reboot the machine. This switch may be over- ridden from the command line with the '/a+' or '/a-' option. If the [AutoBoot] switch is not set from the configuration file or the command line, the program defaults to not performing a warm boot. The [AutoBoot] switch can also be toggled from the menu screen by using the '' key. The [HideFiles] switch may be set to on or off as in: [HideFiles]=ON This will set the default behavior of the program. If the [HideFiles] switch is set to 'ON', the program will set the hidden file attribute bit on the Autoexec.Bat and Config.Sys files to hide them in the root directory. The [LockFiles] keyword causes the program to set the read-only file attribute bit on the new Autoexec.Bat and Config.Sys files. The [BackUp] keyword causes the program to rename the old Autoexec.Bat and Config.Sys files to '*.Bak'. There must be no whitespace between between an identifier and the switch associated with it. The following declarations are illegal: [HideFiles] = ON [AutoBoot]= OFF The remaining program keywords are: [RunDos] [BootDrv] [Config] [Indent] [Include] [Editor] The [RunDos] keyword is used to run a DOS command prior to rebooting the machine. Up to 18 DOS commands can be executed prior to the reboot being performed. An example of a RunDos command might be causing a disk cache to be flushed to insure that the new system files are actually written to the root directory before the warm boot occurs. The command to flush Central Point Software's PC-Cache would be: [RunDos]=PC-Cache /Flush > nul Where the '> nul' is sending the PC-Cache confirmation message to the 'nul' device. This is assuming that the directory where PC-Cache is found is on the path. The [BootDrv] keyword is used when running ChgBoot.Exe from a drive different than the boot-up drive. If the boot-up drive were 'C:', then the following declaration would allow ChgBoot to run from another drive, even a floppy if necessary: [BootDrv]=C: As above, these keywords initialize to a string. Any leading spaces in the string will be included. This means that the following declaration would cause an error: [BootDrv]= C: because the boot drive variable would be initialized to ' C:', and this drive does not exist. The [Config] keyword is used to tell the program how to save and get the current boot-up configuration. The three legal values for [Config] are: 'Off', 'Textfile', & 'Environment': [Config]=Off This tells ChgBoot not to save the configuration information. Whenever the program is run, the menu will display a '?' next to the boot-up configuration string. [Config]=Textfile This tells ChgBoot to save the configuration information in a textfile located in the same directory as the ChgBoot.Exe file. Then when the program is run, the current boot-up configuration letter will be displayed at the menu. Upon running the program for the first time after setting this option, the program will display a message "Unable to open Boot.Cfg file". This is normal because the textfile is only written at the time that the system files are written. The next time that the program is entered, the menu will display the correct information. The only disadvantage with using the 'Textfile' option is that the textfile is written when the new system files are written, not when the system reboots. Therefore, if the system files are written without rebooting, the boot-up configuration information will actually reflect how the system will be rebooted the next time. [Config]=Environment This tells ChgBoot to append a line to the end of the Autoexec.Bat file. The line appended is: "Set Config=X", where 'X' is whichever configuration has been chosen. Then, when the system reboots, the Autoexec.Bat file sets the environment variable. The next time ChgBoot is run, it looks for the environment variable to determine the current boot-up configuration. The [Indent] keyword is used to control the line indenting behavior when writing the Autoexec.Bat and Config.Sys files to the root directory. The allowable values for [Indent] are: 'Off', 'Relative', & 'Absolute'. [Indent]=Off This tells the program to ignore any leading spaces in the strings in the ChgBoot.Cfg file when writing them to the Autoexec.Bat or Config.Sys files. Each string contained between the [AutoStart] keyword and the [AutoEnd] keyword will be written into the Autoexec.Bat file starting at column #1. Each string contained between the [ConfigStart] and [ConfigEnd] keywords will be written into the Config.Sys file starting at column #1. [Indent]=Absolute This tells the program to include all leading spaces in any strings defined in the configuration file in the Autoexec.Bat or Config.Sys files. If a string contained between the [AutoStart] and [AutoEnd] keywords starts at column #7, then the string will be written to the Autoexec.Bat file with 6 spaces and starting at column #7. The same is true for the strings defined between the [ConfigStart] and [ConfigEnd] keywords. [Include]=Relative This tells the program to use relative indenting on the strings. This works by taking the string with the fewest leading spaces and writing it to the appropriate system file starting at column #1. Any other strings are indented relative to it. As an example: [ConfigStart] Break=On Buffers=20 /X Files=30 Shell=C:\Dos\Command.Com /P /E:512 Device=C:\Dos\Qemm386.Sys Ram X=C800-CFFF Device=C:\Dos\LoadHi.Sys /R:1 C:\Dos\RamDrive.Sys 4096 /E Device=C:\Dos\LoadHi.Sys /R:3 C:\Dos\Ansi.Sys Dos=High [ConfigEnd] The line "Break=On" would be written at column #1 in the Config.Sys file as would all the strings lined up with it. The three "Device=" strings would appear indented the same amount as shown here, relative to the other lines. Note that the program does not expand tabs, it simply substitutes one space for each tab found. Therefore, do not have your editor write tabs to the ChgBoot configuration file or the indentation will not be correct. The final keyword [Editor] is used to define the editor that the ChgBoot program will use to interactively edit the ChgBoot.Cfg file. If you are using DOS 5.0 and wanted to use the DOS editor, the correct command would be (assuming DOS Edit is located in the C:\Dos directory): [Editor]=C:\Dos\Edit The ChgBoot program will append the name of the current configuration file onto the string "C:\Dos\Edit" and spawn a process to run the editor. If the default configuration filename were used, the string passed to DOS would be: "C:\Dos\Edit ChgBoot.Cfg". If your editor allows the specification of multiple files on its command line, then you could also use the [Editor] keyword to load the current Autoexec.Bat and Config.Sys files into the editor as well as the ChgBoot.Cfg file. If your editor were "Multi-Edit", this could be done by specifying: [Editor]=ME C:\Autoexec.Bat C:\Config.Sys Then when you invoked the editor from within the ChgBoot program, it would automatically have all three files loaded. The DOS 5.0 Edit editor does not allow the specification of multiple filenames on its command line.