infinte loop

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ahshan.md
Posts: 2
Joined: 19 Apr 2011 08:22

infinte loop

#1 Post by ahshan.md » 19 Apr 2011 11:33

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

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: infinte loop

#2 Post by aGerman » 19 Apr 2011 15:54

... if count equ 10 (

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

Regards
aGerman

ahshan.md
Posts: 2
Joined: 19 Apr 2011 08:22

Re: infinte loop

#3 Post by ahshan.md » 20 Apr 2011 00:37

Hi aGerman



Thanks for the help

shajanjp
Posts: 5
Joined: 28 Apr 2011 22:33

Re: infinte loop

#4 Post by shajanjp » 28 Apr 2011 22:54

In the starting use:
:1


and on end use:
goto1








:)

Post Reply