Oh hell why not, welcome to cmd. Welcome to batch scripting BatMaster.
If you are going to make a basic calculator as you have shown in your post. You have a few different options. You can have it as is and pause and set each piece of data as you have done. You can turn the whole thing into a utility and pass it parameters via the command line using the %1-%9 method, or you could set /p all your data to one string and parse it via the for command.
The first thing you have made a mistake with is the use of (SET INPUT=) You are not setting the input to anything therefore it is not needed. If you want to set a variable that cleans itself after use you can use (setlocal) at the top of your script.
Here is an example to help you with coding your calculator, and as most will tell you calculations in cmd are rather useless because of the limitations in cmd itself. It would be better to learn another language that is capable of performing advanced calculations using easier methods, but I imagine you are just learning, in which case more power to you, and may your adventures be fruitful.
Example 1 (Using your method)Code: Select all
@echo off
@setlocal EnableDelayedExpansion
ECHO;Make a choice
ECHO;Enter the first numerical value.
set /p 1n=
ECHO;Enter your operator
ECHO;+ * / -
set /p sym=
ECHO;Enter the second numerical value
set /p 2n=
set /a sum=!1n! %sym% !2n!
ECHO;%sum%
pause
NOTE:I changed your echos to separate lines though you can do it the way you have to me this just looks cleaner. I also left your variables as is because by consequence you have shown an example of why we use delayedexpansion. If you do something like %1% cmd is looking for command parameter 1 from the command line rather than the variable you are trying to pass to it via your script, if that makes sense.
In your example your variables are backwards and are not displayed as you try to set them.