General discussion

Locked

FOR loops in DOS batch files

By ProblemSlayer ·
I am trying to construct a FOR loop in a dos
batch file, but I am unable to find documentation on how to do it. Basically I have a variable, we will call N that is say equal to 10. I want to execute my for loop N times before exiting the loop. Anyideas?

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

FOR loops in DOS batch files

by jeng In reply to FOR loops in DOS batch fi ...

This should work in WinNT/Win2K (with command extensions enabled) - can't be sure about Win9x.

for /l %1 in (1,1,10) do echo %1

This will loop from 1 to 10 at +1 increments. Do a "for /?" on command line prompt.

Collapse -

FOR loops in DOS batch files

by ProblemSlayer In reply to FOR loops in DOS batch fi ...

Poster rated this answer

Collapse -

FOR loops in DOS batch files

by ProblemSlayer In reply to FOR loops in DOS batch fi ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums