title: For /L loop with padded number
body: <p>I wish to make a nested for loop in order to process some files. I have looked extensively for the solution, and have found many similar versions, but since this is my first time I am having trouble combining methods to do what I want.</p>
  
  <p>Basically - I want a FOR /L loop that cycles through a range of padded numbers from 001 to say 500. </p>
  
  <p>I know I can specify a range (1,1,500), but obviously not as (001,001,500). How can I add the 00, and then subsequently when %%a is >9, just a 0? I imagine this is as a sting but perhaps there is another way?</p>
  
  <p>My code as I wished it to be (obviously wrong):</p>
  
  <pre><code>@echo off
  for %%a in (001,001,500) do (
  echo %%a
  for %%s in (control scenario) do (
  echo %%s
  svic_ensemble.exe 28009_Trent_at_Colwick.cal Trent_%%s_%%a.txt 28009_Trent_at_Colwick.txt     Trent_%%s_%%a.out
  )
  )
  pause
  </code></pre>
  
  <p>Many thanks</p>
  
  <p>Ed</p>