Solving development problems  |  About this blog

Sequence number generator in DOS prompt from Command window

FOR /L %variable IN (start,step,end) DO command [command-parameters] The set is a sequence of numbers from start to end, by step amount. So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would generate the sequence (5 4 3 2 1)

Example:
FOR /L %i IN (1,1,5) DO @echo %i

November 25th, 2009

blog comments powered by Disqus