lundi 7 décembre 2015

if "14" LEQ "7" () failure

I'm making a program that changes coordinate values in a .gcd file, i got the single coordinate lines working but the lines with double coordinates aren't. The program is supposed to split the double coordinates up and run them separately as single coordinates. To accomplish this, I sort the form the coordinates could be in to different sections of code to give the right output. Using the length of the string I can sort them easily. While programming this I ran into a simple problem of a

IF " " LEQ " " ()

command. Given values it gets the wrong outcome. A good example is:

@echo off

:start
if "14" LEQ "7" goto next
echo this should be printed
pause
exit /b

:next
echo this shouldn't be printed
pause
exit /b

Removing the " " seems to fix the issue, but I need to compare variables, which can have spaces, justifying the parenthesis. So the question is:

Why does the interpreter get to the wrong outcome, and how can I easily fix this?

Thanks, -Tom

Aucun commentaire:

Enregistrer un commentaire