Page 1 of 1

infinte loop

Posted: 19 Apr 2011 11:33
by ahshan.md
Hi All

Kindly explain as to why the loop runs infinitely

@echo off
set /a count=1
:loop
if exist d:\p.txt (
echo file found
) else ( if count equ 10 (
goto endloop
) else (
set /a count=%count%+1
echo %count%
goto loop
)
)
:endloop




Thanks & regards
Ahshan

Re: infinte loop

Posted: 19 Apr 2011 15:54
by aGerman
... if count equ 10 (

count is the variable name, but not the variable. Use %count%.

Regards
aGerman

Re: infinte loop

Posted: 20 Apr 2011 00:37
by ahshan.md
Hi aGerman



Thanks for the help

Re: infinte loop

Posted: 28 Apr 2011 22:54
by shajanjp
In the starting use:
:1


and on end use:
goto1








:)