title: Windows batch folder loop with padding
body: <p>I'm wanting to write a batch script to loop over a set of files that have a zero pad on them.  I'm having problems with using set as it seems to be using the last number in my iteration as the value that should be used.
  Here is what I have:</p>
  
  <pre><code> @echo off
  for /L %%r in (1,1,%1) do (
  echo %%r
  set "var=00%%r"
  echo %var%
  )
  </code></pre>
  
  <p>When running this with an input of 5 I get this as output:</p>
  
  <pre><code>1
  005
  2
  005
  3
  005
  4
  005
  5
  005
  </code></pre>
  
  <p>I would like it to be:</p>
  
  <pre><code>1
  001
  2
  002
  3
  003
  4
  004
  5
  005
  </code></pre>
  
  <p>Any help on this would be great.  Thanks.</p>