home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
utility
/
pbaseiv.zip
/
P4UTL006.TIP
< prev
next >
Wrap
Text File
|
1991-12-16
|
1KB
|
53 lines
DOS lacks a batch file command for reading key presses, so I
wrote my own. KEY.COM is like a skeleton key that can unlock
the keyboard for any batch file.
In a batch file, feed KEY a set of characters in commands
like key ynq or key 01234. If you type just key, the
characters default to YN.
KEY waits for you to type a character. The program sets
ERRORLEVEL to 0 for the first character, 1 for the second
character, and so on. For the command KEY YNQ, pressing Y,
N, or Q sets ERRORLEVEL to 0, 1, or 2, respectively.
Wong Choong Sheong
Selango, West Malaysia
Editor's note: KEY.COM is included, in executable form, in
the P4UTIL directory on your PowerBase *.* Volume IV
diskette. To use it, copy it to a directory listed in your
PATH.
KEY ignores case. The commands key AbC and KEY aBc are
functionally identical. For a sample of how to use KEY, run
TESTKEY.BAT [see below]. Press y, n, or q, and the
program will display `Yes', `No', or `Quit', proving that
KEY returned the correct values to the batch file.
TESTKEY.BAT (Use Alt-F to extract)
---- BEGIN LISTING ----
@echo off
echo Press Y, N, or Q.
key ynq
if errorlevel 2 goto QUIT
if errorlevel 1 goto NO
rem -- errorlevel is 0
echo "Yes"
goto END
:NO
echo "No"
goto END
:QUIT
echo "Quit"
:END
echo on
---- END LISTING ----
Title: Skeleton Key
Category: DOS
Issue date: Apr 1991
Editor: Tom Swan
Supplementary files: P4UTIL\KEY.COM