Post by Ted DavisPost by Jim BauerWas just wondering if and/or how I could get choice.com to recognize
the enter or carriage return key as an available key in the "/c" flag.
Basically, you can't.
Yes, you can. See my posted solution in this thread.
Post by Ted DavisOne of the things you can do is to use a utility (not CHOICE) that
reports raw key codes or character numbers.
...it probably can't be done in fewer than the eight
bytes that program uses.
Perhaps, but there is no benefit in counting them.
Post by Ted DavisThe program uses the BIOS function that
waits for a key press, then returns the character number and scan code
- the scan code is discarded and the program terminates with the
character code as its exit code (ERRORLEVEL). The DEBUG script is
a
XOR AX,AX
INT 16
MOV AH,4C
INT 21
rcx
8
ngetch.com
w
There should be a quit command above; placing a 'q' on
the next line after 'w' will prevent debug from hanging.
Here is another debug approach.
:: codescan.bat (makes codescan.com)
@ECHO OFF
ECHO A 100 >%temp%.\codescan.dbg
ECHO MOV AH,0>>%temp%.\codescan.dbg
ECHO INT 16>>%temp%.\codescan.dbg
ECHO MOV AL,AH>>%temp%.\codescan.dbg
ECHO MOV AH,4C>>%temp%.\codescan.dbg
ECHO INT 21>>%temp%.\codescan.dbg
ECHO.>>%temp%.\codescan.dbg
ECHO RCX>>%temp%.\codescan.dbg
ECHO A>>%temp%.\codescan.dbg
ECHO N %temp%.\codescan.com>>%temp%.\codescan.dbg
ECHO W>>%temp%.\codescan.dbg
ECHO Q>>%temp%.\codescan.dbg
DEBUG.EXE <%temp%.\codescan.dbg >nul
The errorlevel set by the above two programs is different.
Getch.com sets errorlevel based on the ASCII decimal value,
and codescan.com sets errorlevel based on the Scan decimal
value.
As seen below, the [5] key on the main keyboard (line 1) is
slightly different than the [5] key on the numeric keypad
(line 2).
ASCII Extended Scan
Key Dec Hex Char Dec Hex Char Dec Hex
-----------------------------------------------------------
5 53 35 5 6 06
5 53 35 5 76 4C
Here is another program by Paul Bartlett which is very similar
to the first program, it sets errorlevel based on the ASCII
decimal value and outputs the actual key value to the screen.
N KEYGET.COM
A 100
MOV AH,01 ;Request Keyboard Input with Echo function 01
INT 21 ;from MSDOS
MOV AH,4C ;Request program end and return exit code (= key code)
INT 21 ;from DOS service routines
RCX
8
W
Q