|
Answer» I have a .BAT program that for some reason, does not execute the COMMANDS like I expected. The code:
IF %3== x GOTO x IF %3== y GOTO y IF %3== z GOTO z
GOTO ERRORMSG
:x IF %4== BAI2CD del Cx COPY %2 CALL prog1 goto end
:y IF %4== BAI2PD del C:y COPY %2 CALL prog goto end
IF %4== BAI2XPD del C:y COPY %2 CALL prog goto end
GOTO ERRORMSG
%3 is y but %4 is not BAI2PD but it is BAI2XPD but the program always goes to the errmsg.
Thanks, ChrisNeither of the first 3 IF statements equates to true. At least ONE of them MUST equate to true before it will BRANCH to anything besides the error message. Maybe your IF statements are COMPARING apples to oranges.Hi 2K Dummy
I understand now what you are saying but am having trouble placing the IF [NOT] check in my code. Where should it go? I still need to check %4 before I decide what to do and I really do not want to have to create 8 .bat programs since at the moment %4 can have 8 different values.
Thanks, ChrisIF condition task
must be on single line.
IF %3==x goto xlabel Works, goes to xlabel if %3 is X
IF %3==x goto xlabel Goes to xlabel unconditionally, the IF line only sets ERRORLEVEL FLAG.
|