|
Answer» Ok well today I tried using two variables inside the "IF" command and checking to SEE if one variable is larger then the other, it of course is rigged for one variable, yet I continue to have it say that the smaller numbered variable is higher and continueing as if it never did the math it just went with the "goto" code at the end of the which ever "if" statement was first. So here's the code if what I typed doesn't make sense. Code: [Select]@echo off set Test=6 set Test2=12 if %Test% GTR %Test2% goto :Done if %Test2% GTR %Test% goto :Done2 :Done It failed. pause :Done2 It worked. pauseEven though its rigged for "Test2" it will still goto ":Done" instead of going to where it should go which is ":Done2". Any one have an idea as to why. Help is greatly appreciated.It WORKS for me....
I cleared it up a bit. See if it works or not.
Code: [Select]@echo off set test1=12 set test2=6 if %test1% GTR %test2% goto :Done1 if %test1% LSS %test2% goto :Done2 :done1 echo. GTR pause exit :Done2 echo LSS pause exitThanks I see where it was having problems. Never really thought to do it that way. Works like a charm now. THANKS again!any ideas what was wrong with yours?It seems it wasn't liking the... Code: [Select]if %Test% GTR %Test2% goto :Done if %Test2% GTR %Test% goto :Done2For what ever reason it wasn't liking the two "IF" commands that where both seeing if one was greater then the other. So I'm guessing that was the problem.I would think for that you would need: Code: [Select]if %test% GTR %test2% ( goto :Done ) else ( goto :Done2 )
wait maybe not Hmm, maybe I'm not 100% sure if that was the cause. Also I don't ever use the "else" statement. It never likes me enough to work right , so I just work around it. Any way thanks for all the help! Have a good day/evening/night/morning(DEPENDING on your time zone).Anytime. Have a good day/evening/night/morning too. Darkenedheart, your first code worked fine on my system. I think when you ran it you must have typed something different from what you posted.
|