-1

I'm wondering how I can open a batch file with another batch file multiple times I'm currently using this code

set counter=0
:loop
call Pinger.bat
SET /A counter=%counter%+1
if %counter% GTR 100
    (GOTO exit) 
else 
    (GOTO loop)
:exit
exit

But it just closes the bat file with this code as soon as the first one of the other one is opened..

dertkw
  • 7,798
  • 5
  • 37
  • 45

1 Answers1

1

Your syntax is wrong on the if statement, see the fixed version below:

set counter=0
:loop
call Pinger.bat
SET /A counter=%counter%+1
if %counter% GTR 100 (
    GOTO exit 
) else (
    GOTO loop
)
:exit
exit
Alex
  • 917
  • 5
  • 11