Solved Missing Operand . Batch file

September 30, 2020 at 20:46:27
Specs: Windows 8
I have made a simple script for addition and subtraction. Script is written below.
@echo off
set "a1=Subtract"
set "a2=Addition"
echo 1.Subtract
echo 2.%a2%
set /p option="Which option do you choose(1,2)":
IF "%option%" EQU "1" (
set /p o1=Write the first number:
set /p o2=Write the second number:
set /a "o3"="%o1%+%o2%"
echo "%o3%" .
) ELSE (
echo Choose the correct option
)
pause

And then its throw this this type of error
Missing operand.
"" .



See More: Missing Operand . Batch file


#1
September 30, 2020 at 23:49:37
✔ Best Answer
@echo off&setlocal enabledelayedexpansion
set "a1=Subtract"
set "a2=Addition"
echo 1.Subtract
echo 2.%a2%
set /p option="Which option do you choose(1,2)":
IF "%option%" EQU "1" (
set /p o1=Write the first number:
set /p o2=Write the second number:
set /a o3=!o1!+!o2!
echo %o3%

) ELSE (
echo Choose the correct option
)
pause

my system specs: https://www.userbenchmark.com/UserR...


Reply ↓  Report •
Related Solutions


Ask Question