Saved Bookmarks
| 1. |
Solve : Make batch react to buttons? |
|
Answer» Dias, this interests me the most. 1. Your code only works for lowercase letters of the alphabet 'a' to 'z'.Would the use of /I make uppercase and lowercase the same?Quote from: Sky Ninja on October 11, 2008, 10:06:52 AM Would the use of /I make uppercase and lowercase the same? The use where? Nevermind, it wouldn't. I meant in the if's. Anyway, I figured out how to get new errorlevel settings. Code: [Select]set key=%errorlevel% [b]echo %errorlevel% >C:\errorlevel.txt[/b] REM ASCII value of key is contained in %Key% Press a known key, then press an unknown key, and if it's different from the known key, you've got a new errorlevel. Code: [Select]If %Key%==48 echo 0 [%Key%] If %Key%==49 echo 1 [%Key%] If %Key%==50 echo 2 [%Key%] If %Key%==51 echo 3 [%Key%] If %Key%==52 echo 4 [%Key%] If %Key%==53 echo 5 [%Key%] If %Key%==54 echo 6 [%Key%] If %Key%==55 echo 7 [%Key%] If %Key%==56 echo 8 [%Key%] If %Key%==57 echo 9 [%Key%] ::---------------------------------------------------------- If %Key%==13 echo ENTER [%Key%] ::---------------------------------------------------------- If %Key%==27 echo Escape [%Key%]Without wishing to be horrible, I will point out that code which contains a zillion lines like this: Code: [Select]IF X = 1 goto one IF X = 2 goto two [...] IF X = 254 goto twofivefour IF X = 255 goto twofivefive (etc) ... is generally the mark of the beginning coder. Sometimes it cannot be avoided, but it is much better to find a more compact SOLUTION, which I already have shown. Hey, this is just an addition to Jacob's code. |
|