How can I preform arithmetic with system variables in batch files?

sort by: active | newest | oldest
Padlock7 years ago

set /a variable = 9 * 8


set /a variable = %var1% + %var2%
geekvig Padlock7 years ago
Hey, nice.  Do you know how to do that with .vbs files?
The same way you'd do it with batch.

a = 1
b = 2
c = a + b
d=msgbox ("C equals: " + c ".")

Or atleast, that should work...
lemonie7 years ago
Have a poke around www.dostips.com/
But bear in mind this is generally basic, crude stuff and you might want to step-up to something like VBS

Re-design7 years ago
It's very limited but halfway down read "Arithmetic".

and here is another answer to look at.  Especially response #3.

It's been too long since I did any batch programming.