Reputation: 53
I am writing a small code where if the day of the month is 01 I need to do some operations.
echo %Date:~0,10%
SET day=%Date:~0,2%
echo %day%
IF %day%==01
(echo success)
It's showing the syntax command is incorrect. Where I am going wrong?
Upvotes: 0
Views: 51
Reputation: 57252
echo %Date:~0,10%
SET day=%Date:~0,2%
echo %day%
IF %day%==01 (echo success)
or
echo %Date:~0,10%
SET day=%Date:~0,2%
echo %day%
IF %day%==01 (
echo success
)
With if command the command that should be executed after the condition should be on the same line or a opening bracket on the same line
Upvotes: 1