Prefix the string with zeros and then take the desired count of characters from the right side:
@echo off
set count=5
setlocal EnableDelayedExpansion
for /L %%i in (1, 1, %count%) do (
set "formattedValue=000000%%i"
echo !formattedValue:~-3!
)
Outputs:
001
002
003
004
005