Reputation: 476
i have batch script (*.bat). i use windows 7. i want to learn how to use FOR syntax to looping
echo off
:bulan
cls
echo.
echo.
set /P start= Input start : %=%
set /P end= Input End : %=%
set mount1=%start%
set mount2=%end%
set i=1
for /L %%i IN (%mount1%,1,%mount2%) DO echo Hello %i% !!!
set i=%%i%+1
pause
Result :
Input start : 1
Input End : 5
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Press any key to continue . . .
How to make result like this
Input start : 1
Input End : 5
Hello 1 !!!
Hello 2 !!!
Hello 3 !!!
Hello 4 !!!
Hello 5 !!!
Press any key to continue . . .
help me please
Upvotes: 0
Views: 1109
Reputation: 41234
for /L %%i IN (%mount1%,1,%mount2%) DO echo Hello %%i !!!
remove this: set i=%%i%+1
Upvotes: 1