Tuesday, 15 May 2012

batch file - IF statement not fired -



batch file - IF statement not fired -

i have little calcutations in dos .bat file:

for /f "tokens=1-3 delims=/-" %%a in ("%tag%") ( set day=%%c set month=%%b set /a year=%%a - 2000 ) echo %day% echo %month% echo %year% echo %stamp% if %month% == "02" ( echo "iam in" )

today if feb month comming 02 if status has not beingness meet. doing wrong ?

your quotes part of string compared. need include them on both sides:

if "%month%" == "02" ( echo "iam in" )

or not have them on either side:

if %month% == 02 ( echo "iam in" )

if-statement batch-file dos

No comments:

Post a Comment