home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / computers / pcjr / utility / DRNU451.LZH / NUASK < prev    next >
Text File  |  1990-10-19  |  3KB  |  69 lines

  1.                                     ASK 
  2.  
  3.  
  4.  
  5. Description:   Using ASK, you can display a prompt message and then await
  6.                single-key input in a batch file. You can supply a list of
  7.                keys that defines the key response that ASK will accept. If
  8.                you provide (keylist), the command returns a DOS ERRORLEVEL,
  9.                which you can test with an IF batch command to control the
  10.                flow of commands in a batch command file. 
  11.  
  12. Syntax:        Version 4.0  ) ASK (prompt)[,(keylist)] 
  13.  
  14.                                 Parameters: 
  15.  
  16. (prompt)       A character string ASK displays while waiting for input. You
  17.                do not need to enclose the prompt in quote marks unless it
  18.                contains either a comma or a single-quote or double-quote
  19.                mark. 
  20.  
  21. (keylist)      A list of the keys (character, number, or symbol) that ASK
  22.                will accept as a response. The list must be a single string of
  23.                characters with no intervening spaces. 
  24.  
  25.  
  26.  
  27.  
  28.                When you supply (keylist), ASK returns ERRORLEVEL based on the
  29.                position in the list of the key you chose. Pressing the first
  30.                key in the list sets ERRORLEVEL equal to 1, pressing the
  31.                second key sets ERRORLEVEL equal to 2, and so on. If you do
  32.                not specify (keylist), pressing any key completes execution of
  33.                the utility with  ERRORLEVEL set to 0. 
  34.  
  35.                                    Notes:
  36.  
  37. The DOS batch command IF ERRORLEVEL (n) evaluates to true whenever (n) is
  38. *less than* or equal to the  current ERRORLEVEL. What this means is that for
  39. the statement, " if ERRORLEVEL 4 goto :START," ERRORLEVEL will evaluate to
  40. true if ERRORLEVEL is 3, 2, or 1.  To obtain the results you want from a set
  41. of IF ERRORLEVEL commands, test for the highest possible ERRORLEVEL first.
  42. See the example below. 
  43.  
  44. The ASK command is available only in version 4.0. ASK is incorporated into
  45. the BE (Batch Enhancer) utility in version 4.5.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55. Example:       To prompt the user with a choice either to continue in a batch
  56.                file or to quit, enter: 
  57.  
  58.                ASK Enter C to continue or Q to quit: ,CQ 
  59.                IF ERRORLEVEL 2 GOTO QUIT 
  60.                :CONTINUE 
  61.                     . additional commands 
  62.                     . 
  63.                     . additional commands 
  64.                :QUIT 
  65.                REM Last line in the batch file 
  66.  
  67.  
  68. See:           <NUBE>, <NUSAMP>
  69.