07-23-2023, 10:37 AM
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.
Basically - I want a FOR /L loop that cycles through a range of padded numbers from 001 to say 500.
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?
My code as I wished it to be (obviously wrong):
@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
Many thanks
Ed
Basically - I want a FOR /L loop that cycles through a range of padded numbers from 001 to say 500.
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?
My code as I wished it to be (obviously wrong):
@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
Many thanks
Ed