Solved Keeps saying missing operand but i don't know what's wrong

September 30, 2019 at 19:40:21
Specs: Macintosh
This is my batch script that when I run it , at the end it says missing operand. What should I do?

@ echo off
set /p UserName= "What is your name?"
echo.
echo "Hello%UserName%, Nice to meet you"
echo.
echo.
echo "Type: 1 for YES or 2 for NO..."
set /a value=1
set /p A= "Have you ever used Batch Script?"
if %A%==%value% (
echo Yes!
pause
exit
)
if NOT %A%==%value% (
echo "Let's try it out today!
pause
)
echo.
pause
echo "Please enter any math operation to solve"
echo.
set /p number_1 ="Enter Variable 1:"
echo.
set /p number_2 ="Enter Variable 2:"
set /a result=%number_one%+%number_two%
echo %result%
echo.
echo "Thank You!"
pause
exit


See More: Keeps saying missing operand but i dont know whats wrong

Reply ↓  Report •

#1
September 30, 2019 at 20:10:32
number_one: number_1 (set /a result)

Reply ↓  Report •

#2
September 30, 2019 at 20:14:00
how would I rewrite that and which line?

message edited by sebasortiz23


Reply ↓  Report •

#3
September 30, 2019 at 21:31:17
✔ Best Answer
this line:
set /a result=%number_one%+%number_two%
to:
set /a result=number_1+number_2

note that the percents are not needed in "set /a" although they are always neede in other cases. however they do not interfere with set /a results.


Reply ↓  Report •
Related Solutions


Ask Question