- 1 year ago
Windows command line - how to specify range?
Comment
1 / 1
In the Windows command line, you can specify a range of values using a FOR
loop. The FOR
command is used to iterate over a range of numbers. Here's how you can do it:
batchFOR /L %%A IN (start,step,end) DO (
REM Your command here using %%A as the current value
)
Replace start
, step
, and end
with the values you want. The loop will iterate from the start value to the end value, incrementing by the step value each time.
For example, to iterate over numbers from 1 to 10 with a step of 2:
batchFOR /L %%A IN (1,2,10) DO (
ECHO %%A
)
This will print the numbers 1, 3, 5, 7, and 9.
If you're looking for something more general, like processing files in a range, you'll need to provide more context about the specific task you're trying to accomplish.