How to use wait.com?
The instructions are as follows:
Usage is as follows
WAIT seconds
Maximum time: 1 hour; Default time: infinite
Returned Errorlevel value:
0: Timeout
1..254: ASCII code of the key pressed (converted to uppercase)
255: Non-ASCII key
Your code can be written as
WAIT
if errorlevel 89 goto A This ASC is Y
if errorlevel 78 goto B This ASC is N
if errorlevel 67 goto C This ASC is C
IF ERRORLEVEL 11 GOTO B This ASC is found to be "start position"
But the following code I wrote doesn't work!
wait 5 please input the number "1" or"2"or"3" rem Stop here for 5 seconds This line executes normally
if errorlevel 49 goto 1 rem 49 is the ASC of 1
if errorlevel 50 goto 2 rem 49 is the ASC of 2
if errorlevel 51 goto 3 rem 49 is the ASC of 3
if errorlevel 0 goto 1 rem 0 is timeout, here the function is to run the code segment 1 if no key is pressed
if errorlevel 255 goto 1
:error
echo error ekede
goto end
:1
echo 1 is called
goto end
:2
echo 2 is called
goto end
:3
echo 1 is called
goto end
:end
No matter which key is pressed, the above code can only run code segment 1. Why is this? (Including keys 2 and 3)
[ Last edited by brightsm on 2005-11-21 at 19:43 ]
The instructions are as follows:
Usage is as follows
WAIT seconds
Maximum time: 1 hour; Default time: infinite
Returned Errorlevel value:
0: Timeout
1..254: ASCII code of the key pressed (converted to uppercase)
255: Non-ASCII key
Your code can be written as
WAIT
if errorlevel 89 goto A This ASC is Y
if errorlevel 78 goto B This ASC is N
if errorlevel 67 goto C This ASC is C
IF ERRORLEVEL 11 GOTO B This ASC is found to be "start position"
But the following code I wrote doesn't work!
wait 5 please input the number "1" or"2"or"3" rem Stop here for 5 seconds This line executes normally
if errorlevel 49 goto 1 rem 49 is the ASC of 1
if errorlevel 50 goto 2 rem 49 is the ASC of 2
if errorlevel 51 goto 3 rem 49 is the ASC of 3
if errorlevel 0 goto 1 rem 0 is timeout, here the function is to run the code segment 1 if no key is pressed
if errorlevel 255 goto 1
:error
echo error ekede
goto end
:1
echo 1 is called
goto end
:2
echo 2 is called
goto end
:3
echo 1 is called
goto end
:end
No matter which key is pressed, the above code can only run code segment 1. Why is this? (Including keys 2 and 3)
[ Last edited by brightsm on 2005-11-21 at 19:43 ]
