SHORTIES\BATCH.DOC ·
DOC ·
3.2 KB ·
1987-12-22 ·
from PCPlus_Issue-21_Jun-1988
BATCH (c) Ray Smith 1987
Description: BATCH is a routine designed to significantly enhance and extend
the range of options available to programmers writing .BAT
programs under MS-Dos. In just 239 bytes, it offers facilities
such as: User interuptable loops
PAUSE with optional defined ECHO
BEEP facility
1 to 10 Second user interuptable delays
YES/NO reply from user )Results from these
Function Key reply from user )routines are given
ASCII reply from user )in ERRORLEVEL.
The program requires MS-Dos version 2.0 or greater, and this is
is checked on entry, with a suitable error message if necesary.
Syntax: BATCH/s[m] where s = switch A,B,F,K,Y,1,2,3,4,5,6,7,8,9,0
[m] is an optional message to be echoed to screen
Options: /a[m] Halts program execution until a key is pressed
The ASCII value of the key pressed is returned in
ERRORLEVEL
[m] is the optional message which will be echoed
to the screen
/b[m] Emits a beep from the loudspeaker
[m] is the optional message which will be echoed
to the screen
/f[m] Halts program execution until a function key is
pressed and returns a value in ERRORLEVEL of 1 to
10 corresponding to the function key pressed.
[m] is the optional message which will be echoed
to the screen
WARNING. If function keys have been redefined using
PROMPT the outcome from this option is unpredictable
/k Examines keyboard status and returns ERRORLEVEL = 0
if no key has been pressed, and ERRORLEVEL = 1 if a
key has been pressed. Program execution is not
halted so by calling the routine and then examining
ERRORLEVEL the program can check if the user wishes
to interupt.
/y[m] Halts program execution until either Y or N key is
pressed. The result ERRORLEVEL = 0 is returned if
N is pressed, ERRORLEVEL = 1 if Y is pressed. The
caps lock or shift status is not important.
[m] is the optional message which will be echoed
to the screen
/N Where N is a digit from 1 to 9 or 0, causes the
program to pause for N seconds. /0 causes a pause
of 10 seconds. The user can interupt the pause by
pressing any key. ERRORLEVEL is set to 0 if the
routine 'times out' and set to 1 if the user
interupted.