title: Calculating remainder in batch?
body: <p>When entered manually into the commnand prompt, the following sequence works as desired:</p>
  
  <pre><code>&gt;set /a r=3%2
  1
  &gt;echo %r%
  1
  </code></pre>
  
  <p>However, when launched from batchh file, it doesn't, as %2 clearly has a different meaning.</p>
  
  <pre><code>&gt;set /a r=3%2
  
  &gt;echo %r%
  3
  </code></pre>
  
  <p>How do I make the batch file do what I did in the first example, claculating the remainder?
  The system in question is XP.</p>