I have some problems with batch file. The file should accept input of 2 numbers from user and then accept input of sign. After that compare users entered sign with "+" sign, however it's not working.
Maybe you will be able to understand better from my code:
echo please enter first number
set /p number0=
echo please enter second number
set /p number1=
echo enter one of the numbers - ^+ - / ^*
set /p symbol="set the variable: "
echo %symbol%
set plus=+
echo %plus%
pause
if /i "%symbol%" EQU "+"(
echo your choice is to sum up the numbers
pause
set /a answ = %number0% + %number1%
echo answer:
echo %answ%
)
I already tried using if /i %symbol% == plus
, tried to use quotes in any combination I was able to imagine. I tried to assign operator plus variable like this set /p plus="+"
then using "" around symbol variable, and so on.
But still nothing works, after I reach part where variable should be compared with symbol +
my batch file just crashes. All variables are assigned correctly.
That's the link to see full file if it's necessary, however please note that full file isn't written in English language: https://1drv.ms/u/s!Ap4-t2P-Igzihb5shQZLNkKySEWOrQ.
` line breaks - paragraphs are much more readable. – halfer Dec 19 '17 at 14:57