Calculating remainder in batch?

Viewed 3238

When entered manually into the commnand prompt, the following sequence works as desired:

>set /a r=3%2
1
>echo %r%
1

However, when launched from batchh file, it doesn't, as %2 clearly has a different meaning.

>set /a r=3%2

>echo %r%
3

How do I make the batch file do what I did in the first example, claculating the remainder? The system in question is XP.

1 Answers
Related