2 Answers
2

You have to set a variable with enough zeros on the front, then take the last few characters to give the correct range. Delayed expansion means that the variables used will not be evaluated only once when the do is encountered, but every time the variable is used.

This example will print 1-200

@echo off
setlocal enabledelayedexpansion
for /l %%a in (1,1,200) do (
set test1=00%%a
set test2=!test1:~-3!
echo !test2!
)