I am trying to compare a fixed date with current system date. I want to check if the current date is greater or same than fixed date. Example:
@ECHO OFF
set fixedDate=27-09-2018
set current=%date%
if %current% GEQ %fixedDate% (goto there) else (goto here)
:here
echo "do nothing"
:there
echo "yes run it"
Output:
"do nothing"
"yes run it"
Above code isn't working. Any suggestion in where I am doing mistake? Thanks in advance :)
Edit:
I tried like this:
@ECHO OFF
set FixedDate=27-09-2018
set current=%date%
set "sdate1=%current:~-4%%current:~3,2%%current:~0,2%"
set "sdate2=%FixedDate:~-4%%FixedDate:~3,2%%FixedDate:~0,2%"
if %sdate1% GEQ %sdate2% (goto there) else (goto here)
:here
echo "do nothing"
:there
echo "yes run it"
Didn't work either.
Output:
"yes run it"