Windows can't compare?
Hi, after my last question about why Windows accepts variables incorrectly, I now have a much stranger problem as shown in the attachment.
When I try to compare a variable with a string from a batch script, Windows says it's false. However, if I do it directly from the shell, I don't have any problems. What could be causing this?
Can you set your code copyable to a code day here?
In addition, at first glance, I would not use reserved commands for variable names (FOR).
In terms of the overview and in order to avoid errors due to spaces, I would also make more use of quotation marks.
I tried quotation marks, I didn’t. And yes I can add the code quickly.
Your mistake is logical. The ELSE refers only to the last IF.
If getFileExt.bat has determined a .ISO, the FOR variable is initially set to ISO…
In the last IF (test to .esd), however, the condition is not fulfilled and the error message is output accordingly.
You would have to interlock the IF/ELSE several times or, after each of the first IF tests, insert a GOTO to your own jump mark immediately after the SET.
devastating from a lot of forgotten “Quotes”…
the else branch only works the last if. This also affects the previously compared extensions by the else.
Remedial, if detected jump away, then at the end only the undesired remains…
have I not been saying?