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

 
Output of file : ASK.DOC contained in archive : ABFS.ZIP
PROGRAM: ASK.COM

FUNCTION: Prompts User for a Reply and Sets ERRORLEVEL


This utility, which is intended for use in .BAT files, simply
prompts the user for a single-character reply, and uses that
reply to set the DOS "ERRORLEVEL" value, which can then be
tested within a .BAT file to control its execution. The
default reply is "Y", which sets ERRORLEVEL to 0 (Zero),
while "N" or "n" sets ERRORLEVEL to 1 (One). However, if the
prompt coded as a parameter starts with a semicolon (";"), this
version of ASK will allow replies of from "0" through "9" and
set ERRORLEVEL to that value, thus allowing ASK Choice; followed
by a .BAT branch on any one of 10 Menu choices!

Invocation:
-----------
(1) ASK

Prompts: Reply Yes or No. (Y/n) ==>
Accepts: "Y", "y", "N", "n" or {ENTER} ("Y" default).

(2) ASK User Supplied Prompt

Prompts: User Supplied Prompt ==>
Accepts: "Y", "y", "N", "n" or {ENTER} ("Y" default).

(3) ASK ;

Prompts: Reply with a digit (0-9) ==>
Accepts: "0" .. "9" or {ENTER} ("0" default).

(4) ASK ;Enter your choice

Prompts: Enter your choice ==>
Accepts: "0" .. "9" or {ENTER} ("0" default).

Notes: The keyboard is not "cleared" before the prompt. Thus,
you can type ahead of the prompts if a batch file needs
several replies.

Use: Yourfile.BAT
------------
...
ASK Use Spooler
IF ERRORLEVEL 1 GOTO NO
GOTO YES

Remember, ERRORLEVEL n tests for a value GREATER THAN OR EQUAL
to "n". Thus, if using the menu choice 0-9 option, you MUST
code:

...
ASK ;Menu Choice
IF ERRORLEVEL 2 GOTO MENU2
IF ERRORLEVEL 1 GOTO MENU1
...

W.B. Malthouse
M-SQUARED Systems, Inc.
5201 George McKay Ct.
Fairfax, Va 22030




  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : ABFS.ZIP
Filename : ASK.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/