Calculating in a batch file

December 20, 2010 at 18:43:46
Specs: Windows XP/Vista
I have a batch file that accepts user input and then writes it to a text file. What I need to know is how to do a calcultion with two of the user defined varibles to equal a new variable. Here is th e my code.
@echo off
set age=
set /P age=set first number?: %=%
echo %age% >>temp.txt
set cost=
set /P cost=set second number: %=%
echo %cost% >>temp.txt

See More: Calculating in a batch file

Report •

December 20, 2010 at 18:56:10
To do some basic math:

set /a variable=var1 + var2
set /a variable=var1 - var2


There is no floating point(whole numbers only). There are size limitations (either 2^31-1 or 2^63-1).

More info:

set /?

Report •
Related Solutions

Ask Question