home *** CD-ROM | disk | FTP | other *** search
- ASK
-
-
-
- Description: Using ASK, you can display a prompt message and then await
- single-key input in a batch file. You can supply a list of
- keys that defines the key response that ASK will accept. If
- you provide (keylist), the command returns a DOS ERRORLEVEL,
- which you can test with an IF batch command to control the
- flow of commands in a batch command file.
-
- Syntax: Version 4.0 ) ASK (prompt)[,(keylist)]
-
- Parameters:
-
- (prompt) A character string ASK displays while waiting for input. You
- do not need to enclose the prompt in quote marks unless it
- contains either a comma or a single-quote or double-quote
- mark.
-
- (keylist) A list of the keys (character, number, or symbol) that ASK
- will accept as a response. The list must be a single string of
- characters with no intervening spaces.
-
-
-
-
- When you supply (keylist), ASK returns ERRORLEVEL based on the
- position in the list of the key you chose. Pressing the first
- key in the list sets ERRORLEVEL equal to 1, pressing the
- second key sets ERRORLEVEL equal to 2, and so on. If you do
- not specify (keylist), pressing any key completes execution of
- the utility with ERRORLEVEL set to 0.
-
- Notes:
-
- The DOS batch command IF ERRORLEVEL (n) evaluates to true whenever (n) is
- *less than* or equal to the current ERRORLEVEL. What this means is that for
- the statement, " if ERRORLEVEL 4 goto :START," ERRORLEVEL will evaluate to
- true if ERRORLEVEL is 3, 2, or 1. To obtain the results you want from a set
- of IF ERRORLEVEL commands, test for the highest possible ERRORLEVEL first.
- See the example below.
-
- The ASK command is available only in version 4.0. ASK is incorporated into
- the BE (Batch Enhancer) utility in version 4.5.
-
-
-
-
-
-
-
-
-
- Example: To prompt the user with a choice either to continue in a batch
- file or to quit, enter:
-
- ASK Enter C to continue or Q to quit: ,CQ
- IF ERRORLEVEL 2 GOTO QUIT
- :CONTINUE
- . additional commands
- .
- . additional commands
- :QUIT
- REM Last line in the batch file
-
-
- See: <NUBE>, <NUSAMP>
-