Knowledge Walls
John Peter
Pune, Maharashtra, India
Things to Know [cont'd]
For Loop in Decision making of MS-DOS Commands
7378 Views
Hints 
For is a looping statement. It has three parts. One is initialization part, second one is condition part and another one is increment or decrement part.

Intial part will execute once. After that goes to the condition part if condition is tree then executes block of statement. After that executes increment or decrement part then moves to condition again. This looping continues till condition is getting false.
For each... in 
for %n in (1 2 3 4 5) do echo %n

Above for loop will loop five times. 1 to 5.

For commands - %n
For batch file - %%n

How to use multiple statements in batch file with For loop?
for %%n in (1 2 3 4 5) do (
echo %%n
echo N value is: %%n
- - -
set file_name=%%n )
Next Topics
Next lessons of current book.
Decision making of MS-DOS Commands
Decision making of MS-DOS Commands
Decision making of MS-DOS Commands
File System of MS-DOS Commands
Previous Topics
Previous lessons of current book.
Things to Know of MS-DOS Commands
Best Lessons of "MS-DOS Commands"
Top lessons which are viewed more times.
Arithmetic Operators of MS-DOS Commands
Arithmetic Operators of MS-DOS Commands
String manipulation of MS-DOS Commands
Relational Operators of MS-DOS Commands
String manipulation of MS-DOS Commands
String manipulation of MS-DOS Commands
Things to Know of MS-DOS Commands
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details