133Views5Replies

Author Options:

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


5 Replies

user
Padlock (author)2010-05-06

Hmm..

set /a variable = 9 * 8

or

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

Select as Best AnswerUndo Best Answer

user
geekvig (author)Padlock2010-05-06

Hey, nice.  Do you know how to do that with .vbs files?

Select as Best AnswerUndo Best Answer

user
Prof. Pickle (author)geekvig2012-12-15

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...

Select as Best AnswerUndo Best Answer

user
lemonie (author)2010-05-07

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

L

Select as Best AnswerUndo Best Answer

user
Re-design (author)2010-05-06

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.

Select as Best AnswerUndo Best Answer