Solved errorlevel expression problem in batchfile

May 5, 2012 at 22:46:17
Specs: Windows 7
hello
i have an assignment from scool, i have to make a batchfile that i have to run together with a debug program to catch the errorlevels of the keyboardinput, wheb i type a letter that the cmd prompt returns wich letter i pressed . i used a debug program to return the errorlevel , and i putted it on my desktop with the following lines in cmd:
-debug
-e 100 b4 00 cd 16 24 df b4 4c cd 21
-rcx
-a
-w
-q

the only thing that the batchfile does is retuning this message" this command is unexpected at this time" and closes immediately .


if errorlevel==90 goto z
if errorlevel==89 goto y
if errorlevel==88 goto x
if errorlevel==87 goto w
if errorlevel==86 goto v
if errorlevel==85 goto u
if errorlevel==84 goto t
if errorlevel==83 goto s
if errorlevel==82 goto r
if errorlevel==81 goto q
if errorlevel==80 goto p
if errorlevel==79 goto o
if errorlevel==78 goto n
if errorlevel==77 goto m
if errorlevel==76 goto l
if errorlevel==75 goto k
if errorlevel==74 goto j
if errorlevel==73 goto i
if errorlevel==72 goto h
if errorlevel==71 goto g
if errorlevel==70 goto f
if errorlevel==69 goto e
if errorlevel==68 goto d
if errorlevel==67 goto c
if errorlevel==66 goto b
if errorlevel==65 goto a
if error level==27 exit


:a
echo u hebt a gedrukt
pause

goto begin

:b
echo u hebt b gedrukt
pause
goto begin
:c
echo u hebt c gedrukt
pause
goto begin
:d
echo u hebt d gedrukt
pause
goto begin
:e
echo u hebt e gedrukt
pause
goto begin
:f
echo u hebt f gedrukt
pause
goto begin
:g
echo u hebt g gedrukt
pause
goto begin
:h
echo u hebt h gedrukt
pause
goto begin
:i
echo u hebt i gedrukt
pause
goto begin
:j
echo u hebt j gedrukt
pause
goto begin
:k
echo u hebt k gedrukt
pause
goto begin
:l
echo u hebt l gedrukt
pause
goto begin
:m
echo u hebt m gedrukt
pause
goto begin

:n
echo u hebt n gedrukt
pause
goto begin


:o
echo u hebt o gedrukt
pause
goto begin
:p
echo u hebt p gedrukt
pause
goto begin

:q
echo u hebt q gedrukt
pause
goto begin

:r
echo u hebt r gedrukt
pause
goto begin

:s
echo u hebt s gedrukt
pause
goto begin

:t
echo u hebt t gedrukt
pause
goto begin

:u
echo u hebt u gedrukt
pause
goto begin

:v
echo u hebt v gedrukt
pause
goto begin

:w
echo u hebt w gedrukt
pause
goto begin

:x
echo u hebt w gedrukt
pause
goto begin
:y
echo u hebt y gedrukt
pause
goto begin

:z
echo u hebt z gedrukt
pause
goto begin


See More: errorlevel expression problem in batchfile

Report •


✔ Best Answer
May 7, 2012 at 13:16:17
do i have to use the command call in the script to use the debug program ?
You don't have to use the CALL command, but you do have to call the debugger.

yes i use 64bit os
The 16-bit emulation layer is not available on 64-bit versions of Windows. This means no DEBUG. I suggest you get your teachers to update their curriculum. DOS has been obsolete for almost 20 years now.

wenever button i press it goes to the a: label
Probably because you never call the program you wrote in DEBUG.

How To Ask Questions The Smart Way



#1
May 6, 2012 at 08:29:57
if error level==27 exit
Well, I see this error.

How To Ask Questions The Smart Way


Report •

#2
May 6, 2012 at 09:22:26
there is no :begin either?

mike


Report •

#3
May 6, 2012 at 10:16:43
Yeah, it's obviously only part of the full script; you'll notice he doesn't include the call to the .com file he created with debug. (Assuming he's not using 64-bit.)

How To Ask Questions The Smart Way

↓↓↓ EDIT: I'm assuming he "knows" the previous code works, so he's only including the bit that's breaking. That's part of the advice that I link to in my signature. ↓↓↓


Report •

Related Solutions

#4
May 6, 2012 at 11:56:33
I never understand, why people hide code. Specially people hunting for help.

mike


Report •

#5
May 7, 2012 at 08:57:19
i already changed it, but it makes no diference

Report •

#6
May 7, 2012 at 10:28:25
this is the whole script , do i have to use the command call in the script to use the debug program ? and yes i use 64bit os .


:begin

echo druk een toets in van a...z .

pause

if errorlevel==90 goto z


if errorlevel==89 goto y


if errorlevel==88 goto x
if errorlevel==87 goto w
if errorlevel==86 goto v
if errorlevel==85 goto u
if errorlevel==84 goto t
if errorlevel==83 goto s
if errorlevel==82 goto r
if errorlevel==81 goto q
if errorlevel==80 goto p
if errorlevel==79 goto o
if errorlevel==78 goto n
if errorlevel==77 goto m
if errorlevel==76 goto l
if errorlevel==75 goto k
if errorlevel==74 goto j
if errorlevel==73 goto i
if errorlevel==72 goto h
if errorlevel==71 goto g
if errorlevel==70 goto f
if errorlevel==69 goto e
if errorlevel==68 goto d
if errorlevel==67 goto c
if errorlevel==66 goto b
if errorlevel==65 goto a
if errorlevel==27 exit


:a
echo u hebt a gedrukt
pause

goto begin

:b
echo u hebt b gedrukt
pause
goto begin
:c
echo u hebt c gedrukt
pause
goto begin
:d
echo u hebt d gedrukt
pause
goto begin
:e
echo u hebt e gedrukt
pause
goto begin
:f
echo u hebt f gedrukt
pause
goto begin
:g
echo u hebt g gedrukt
pause
goto begin
:h
echo u hebt h gedrukt
pause
goto begin
:i
echo u hebt i gedrukt
pause
goto begin
:j
echo u hebt j gedrukt
pause
goto begin
:k
echo u hebt k gedrukt
pause
goto begin
:l
echo u hebt l gedrukt
pause
goto begin
:m
echo u hebt m gedrukt
pause
goto begin

:n
echo u hebt n gedrukt
pause
goto begin


:o
echo u hebt o gedrukt
pause
goto begin
:p
echo u hebt p gedrukt
pause
goto begin

:q
echo u hebt q gedrukt
pause
goto begin

:r
echo u hebt r gedrukt
pause
goto begin

:s
echo u hebt s gedrukt
pause
goto begin

:t
echo u hebt t gedrukt
pause
goto begin

:u
echo u hebt u gedrukt
pause
goto begin

:v
echo u hebt v gedrukt
pause
goto begin

:w
echo u hebt w gedrukt
pause
goto begin

:x
echo u hebt w gedrukt
pause
goto begin
:y
echo u hebt y gedrukt
pause
goto begin

:z
echo u hebt z gedrukt
pause
goto begin


Report •

#7
May 7, 2012 at 10:32:49
i tried it on my other pc that runs an 32 bit os and . and wenever button i press it goes to the a: label and echos what beneed it .

Report •

#8
May 7, 2012 at 13:16:17
✔ Best Answer
do i have to use the command call in the script to use the debug program ?
You don't have to use the CALL command, but you do have to call the debugger.

yes i use 64bit os
The 16-bit emulation layer is not available on 64-bit versions of Windows. This means no DEBUG. I suggest you get your teachers to update their curriculum. DOS has been obsolete for almost 20 years now.

wenever button i press it goes to the a: label
Probably because you never call the program you wrote in DEBUG.

How To Ask Questions The Smart Way


Report •

#9
May 8, 2012 at 07:50:06
My appologies Razor2.3, you make a rational point. Thank You for the reminder.

mike


Report •

#10
May 8, 2012 at 09:45:49
Well, in this case having all of the code would allow us to point out he was missing significant chunks of it sooner, so I'd say you were right. So it goes.

How To Ask Questions The Smart Way


Report •

#11
May 13, 2012 at 06:42:59
tanks to all of you for helping me ! see ya later

Report •


Ask Question