我有批处理脚本(* .bat)。我使用Windows 7.我想学习如何使用FOR语法循环
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
结果:
Input start : 1
Input End : 5
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Hello 1 !!!
Press any key to continue . . .
如何制作这样的结果
Input start : 1
Input End : 5
Hello 1 !!!
Hello 2 !!!
Hello 3 !!!
Hello 4 !!!
Hello 5 !!!
Press any key to continue . . .
请帮助我
答案 0 :(得分:1)
for /L %%i IN (%mount1%,1,%mount2%) DO echo Hello %%i !!!
删除此内容:set i=%%i%+1
答案 1 :(得分:0)
for /l %%a in (1,1,%counter%) do echo Hello...