in a Windows cmd batch file (.bat), how do i pad a numeric value, so that a given value in the range 0..99 gets transformed to a string in the range \"00\" to \"99\". I.e. I
This example uses a for loop to demonstrate, but the logic is the same even if you were to use it without the loop. Just echo a 0 in front if the number is less than 10.
setlocal enabledelayedexpansion
for /l %%a in (1,1,40) do (
set n=%%a
if !n! lss 10 (
echo 0!n!
) else (
echo !n!
)
)
pause >nul