2013-08-12 5 views
0

J'ai un script batch (* .bat). i utiliser Windows 7. Je veux apprendre comment utiliser la syntaxe à effectuer une boucleBouclage en utilisant FOR en batch (* .bat)/CMD

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 

Résultat:

Input start : 1 
Input End : 5 
Hello 1 !!! 
Hello 1 !!! 
Hello 1 !!! 
Hello 1 !!! 
Hello 1 !!! 
Press any key to continue . . . 

Comment faire tel résultat

Input start : 1 
Input End : 5 
Hello 1 !!! 
Hello 2 !!! 
Hello 3 !!! 
Hello 4 !!! 
Hello 5 !!! 
Press any key to continue . . . 

Aidez-moi s'il vous plaît

Répondre

1
for /L %%i IN (%mount1%,1,%mount2%) DO echo Hello %%i !!! 

supprimer ceci: set i=%%i%+1

+0

merci beaucoup. travaille pour moi. – flyingbird013

0
for /l %%a in (1,1,%counter%) do echo Hello... 
+0

'pour/l %% a dans (1,1,% compteur%) écho Bonjour %% a' Vous avez de nouveau manqué a,' %% a'. Quoi de neuf avec votre machine à café? ^^ – Stephan

+0

Merci pour votre réponse. mais je suis désolé, j'ai éditer ma question – flyingbird013

+0

ne pas améliorer les questions, c'est contre thr SO règles. Faites simplement de nouveaux. – Endoro