Q: IF ELSE GOTO not working BAT I cant get my if else to work as expected
The code Im ussing is as follows
echo %DATE%
set EXPDATE=%DATE:~9,4%%DATE:~6,2%%DATE:~3,2%
IF %EXPDATE% GEQ "20150106" (GOTO EXPIRED) ELSE (GOTO CONTINUE)
exit

:EXPIRED
MSG * update
exit

:CONTINUE
MSG * other code
exit


A: Reason: You are compariing 20140101 against "20150106". Since at least one side is not a pure-numeric string, a string-comparison is performed. " is always less than 2
Solution: remove the quotes OR similarly quote the left-hand-side.
