Category : Batch File Utilities - mostly for DOS
Archive   : BATQUES.ZIP
Filename : BATQUES.DOC

 
Output of file : BATQUES.DOC contained in archive : BATQUES.ZIP
Bat-Ques
--------

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
are supported.

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
very friendly).

Examples:

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)
.
echo off
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
:badresp
echo Your response was invalid. Sorry.
goto endit
:minceed
if not exist mincomm.sum copy \bin\mince.swp mince.swp
mince %1
if not exist mincomm.sum del mince.swp
goto endit
:ibmed
profed %1
:endit
echo on

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
simplicity sake.

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.




  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : BATQUES.ZIP
Filename : BATQUES.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/