Thanks in advance
Kundurs
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
This is a surprisingly easy thing to do when using the CHOICE command. The
batchfile copied below will ask for one of the numeric characters, echo
whatever is entered, and ask for more until the esc key is entered. The
"$" stands for the escape character, which must be entered by you. To
enter it with DOS EDIT, press CTRL-P, ESC.
@echo off
cls
:loop
echo.
echo.
echo Enter a number 0 - 9. To terminate, press ESC.
choice /n /c0123456789$ >nul
:: ^
:: ESC
cls
if errorlevel 1 if not errorlevel 2 echo You pressed 0.
if errorlevel 2 if not errorlevel 3 echo You pressed 1.
if errorlevel 3 if not errorlevel 4 echo You pressed 2.
if errorlevel 4 if not errorlevel 5 echo You pressed 3.
if errorlevel 5 if not errorlevel 6 echo You pressed 4.
if errorlevel 6 if not errorlevel 7 echo You pressed 5.
if errorlevel 7 if not errorlevel 8 echo You pressed 6.
if errorlevel 8 if not errorlevel 9 echo You pressed 7.
if errorlevel 9 if not errorlevel 10 echo You pressed 8.
if errorlevel 10 if not errorlevel 11 echo You pressed 9.
if not errorlevel 11 goto loop
:end
set !R!=
cls
echo.
echo.
echo goodbye
I tried this under win95. It does not recognize the ESC key. and
ctrl-p,ESC causes the following message:
write fault error writing device PRN
Abort, Retry?
My mistake. My dyslexia is overwhelming me. Anyway, to put a twist on
the question, can anyone modify this batch file or write a new one
which, when executed, can recognize "enter" or any other key or other
key-combination such as ctrl-r or F3 key. I suppose it would involve the
ascii character codes. such as:
ctrl-r = 18
F3 = 0;61
enter = ???
But I dont know how to accomplish this.
email: GREENliza...@juno.com (without the GREEN's)