home *** CD-ROM | disk | FTP | other *** search
- program: ask_bat
-
- Copyright 1989 Floyd D. Pretz Sr.
- 5834 Spaulding St.
- Omaha, NE 68104
-
- Distribution of this program for non-commercial purposes
- is permitted. Author assumes no liability for losses due to
- malfunction of this program.
-
- Description: The ask_bat program was designed to allow
- for timed response to (Y/N) type prompts
- in .BAT files - esp the Autoexec.bat file.
- The program was written to satisfy a need
- to recover from a system reboot of a BBS
- (Bulletin Board System) following the loss
- of modem carrier, and still allow the system
- operator (if present) to answer typical
- configuration 'boot' questions. Using ask_bat
- with timing options, the system will not wait
- indefinitely for console response, but will assume
- a default response after a specified period of
- time. This also allows you the opportunity to
- go fill your coffee cup during the boot process
- and not wait around to answer batch prompts.
-
- Use: ask_bat [ "string" errlev ... ] [ /T:nnn ] [ /H ] [ /F ] [ /P "prompt" ]
-
- where: 'string' is an optional keyboard (console)
- response to which the program will exit with
- an ERRORLEVEL set to errlev. You can use as
- many of the 'string'-errlev sets as you wish
- (DOS command line can not exceed 128 characters).
- The absence of any such pairs will function
- as 'Press any key to continue' with the
- errorlevel set to 0. 'string' is not case
- sensitive (i.e. 'Yes', 'YES' & 'yEs' are
- treated identically).
-
- /T:nnn is an option to time keyboard activity
- and exit ask_bat after nnn seconds. If the
- /T parameter is not specified or nnn=0 then
- keyboard activity is not timed and ask_bat will
- wait indefinitely for console activity. In the
- case of a time out (user did not respond within
- nnn seconds) the default is assumed to be the
- first 'string'-errlev parameter (if any).
- The default is also assumed if the console
- response is null (Enter key only).
-
- /H is an option to enable a HOT KEY feature
- which attempts to match a single keystroke
- to one of the 'string' parameters and exit
- accordingly.
-
- /F is an option to force the user to key in
- one of the 'strings' in order to exit the program.
- the program will 'beep' if an incorrect entry
- is detected.
-
- /P prompt is an option to display a string on the
- screen without forcing a <RETURN>.
-
- Invocation without any parameters will function
- similar to the DOS PAUSE statement.
-
- examples: ask_bat yes 1 no 2 maybe 3 /T:15 /H
-
- will exit with errorlevel=1 if the
- character 'Y' or 'y' is pressed or
- if 15 seconds elapses or only the
- <RETURN> key is pressed. Also exits with
- errorlevel=2 if 'N' or 'n' is pressed
- and exits with errorlevel=3 if 'M' or
- 'm' is pressed.
-
- ask_bat /H
-
- Functions similar to the PAUSE command.
-
- ask_bat tom 10 dick 20 /F
-
- Will exit with errorlevel=10 if 'TOM',
- 'tom', 'Tom', etc is keyed in, or exit
- with errorlevel=20 if 'Dick', etc is keyed
- in. Because of the '/F' parameter one
- of these two responses must be keyed in
- in order for ask_bat to exit.
-
- ask_bat yes 3 no 2 /H /T:15 /P "Continue --> "
-
- Will display the prompt string and then
- wait up to 15 seconds for a hot key.
-
- ask_bat ? > readme.txt
-
- This will create the readme.txt file
- which you can later print. Or ...
-
- ask_bat ? | more
-
- Which will force the screen to pause
- while you read the help text.
-