Calculating remainder in batch?
batch-file
Solution
use this syntax in batch-files:
set /a "r=3 %% 2"
Problem
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.