Search found 2 matches

by tomato
15 Mar 2013 01:08
Forum: DOS Batch Forum
Topic: Break Loop infinite
Replies: 9
Views: 8053

Re: Break Loop infinite

@Antonio sorry for my mistake. I did not watch the code carefully. @ngusaomanoi In your for-loop, (1, 0, 10) -> (start, step, end) because the step is 0, the start(=1) cannot reach the end(=10). Therefore it causes an infinite loop. Replace step to any other value greater than 0. eg. (1, 1, 10)
by tomato
14 Mar 2013 19:46
Forum: DOS Batch Forum
Topic: Break Loop infinite
Replies: 9
Views: 8053

Re: Break Loop infinite

To break in for-loop, use "goto ~ label" statement as followings.

for /L %%n in (1,0,10) do (
echo "infinite\n"
if exist "%~dp0\Parts\file.xml" (
goto :break
)
)
:: label
:break