Arithmetic inside Round brackets leads to Missing operand
Posted: 13 Mar 2020 09:19
I tried to use arithmetic inside IF statement
and I've got error saying Missing operand I wonder if I need to EnableDelayedExpansion for arithmetic to work inside the IF statement
Full script
Output:
Code: Select all
SET "Result=8"
SET /A "Result=%Result% * 2"
echo %Result% asdfghjkl
Full script
Code: Select all
@ECHO OFF
REM Get current Year and Month for Windows 10
set "year_now=%date:~2,2%";
set "month_now=%date:~5,2%";
echo %year_now%
echo %month_now%
set "releaseCycle=Interim";
IF "%releaseCycle%"=="LTS" (
echo useful
) ELSE IF "%releaseCycle%"=="Interim" (
IF %month_now% LSS 04 (
SET "Result=8"
SET /A "Result=%Result% * 2"
echo %Result% asdfghjkl
)
echo interim here
) ELSE IF "%releaseCycle%"=="Daily" (
echo useful
) ELSE (
echo useful
)
pause
Code: Select all
20
03
Missing operand.
asdfghjkl
interim here