Contents of the BATQUES.DOC file
To ask a question:
Bat-Ques tttttt$ where ttttttt is the text of the question
User then keys a single character response.
To check answer, use IF [not] errorlevel cc, where cc is the
character code value of the response. Only single character responses
This program allows one to build decently friendly batch files. One
no longer has only the ctrl-break response to a pause (which isn't
This program allows a batch file to ask the user a question and
return a one-character response which is testable by the IF
subcommand of bat files, via the errorlevel.
You use the question asker per following example:
. (your batch file to ask if user wants to edit with
. mince/emacs or ibm's editor)
bat-ques WHICH EDITOR, m OR e FOR MINCE (EMACS), i FOR IBM's? $
if errorlevel 110 goto badresp
if errorlevel 109 goto minceed
if errorlevel 106 goto badresp
if errorlevel 105 goto ibmed
if errorlevel 102 goto badresp
if errorlevel 101 goto minceed
echo Your response was invalid. Sorry.
if not exist mincomm.sum copy \bin\mince.swp mince.swp
if not exist mincomm.sum del mince.swp
Note that the question prompt follows the bat-ques command and must
end with a dollar sign. The ascii value of the response is returned
as the error level. Since error level tests are always greater than
or equal tests, you must check for highest value first and lowest
value last. Example above shows what you do to check for missing
values. Note that the example assumes lower case answers only for
Ascii values (e.g., A is 65, B is 66, a is 97) are found in back of
your BASIC manual. Only one character responses are accepted, and
they are not followed by a carriage return.
Extended ascii codes (function and alt keys) should work as per page
G-6 of your BASIC manual; the first call to bat-ques will return a
zero and the next call (presumably "bat-ques $" without another
prompt) will return the number shown on page G-7.