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:
@echo off
for /L %%r in (1,1,%1) do (
echo %%r
set "var=00%%r"
echo %var%
)
When running this with an input of 5 I get this as output:
1
005
2
005
3
005
4
005
5
005
I would like it to be:
1
001
2
002
3
003
4
004
5
005
Any help on this would be great. Thanks.