Reputation: 747
I don't understand why this keeps returning syntax errors. Can somebody take look and tell me how I can get it to correctly work.
for /L %%n in (1, 10, 100, 1000, 10000, 100000) do ( test.exe %%n )
Upvotes: 0
Views: 870
Reputation: 41244
To answer your followup question, just add parentheses to add more commands in a loop.
@echo off
for /l %%N in (0 10 100) do (
echo ======[A]======
echo %%N
echo ======[B]======
)
Upvotes: 1
Reputation: 130869
If you want to iterate a list of values, then you want a simple FOR with no option:
@echo off
for %%N in (1 10 100 1000 10000 100000) do echo %%N
result
1
10
100
1000
10000
100000
If you want to iterate a range of numbers, then use the /L option. The IN clause requires three arguments - startValue, Increment, and endValue
@echo off
for /l %%N in (0 10 100) do echo %%N
result
0
10
20
30
40
50
60
70
80
90
100
Your code with the /L option and 6 values in the IN() clause is invalid
Upvotes: 1
Reputation: 80083
FOR /L syntax is for /L %%x in (start,step,end) do
which sets %%x
to start for the first loop, alters it by step for each loop until it reaches end
.
remove the /L
if you want to run test.exe
with the contents of a list.
Upvotes: 1