How to create an infinite loop in Windows batch file?

sooprise picture sooprise · Mar 30, 2011 · Viewed 367.5k times · Source

This is basically what I want in a batch file. I want to be able to re-run "Do Stuff" whenever I press any key to go past the "Pause".

while(true){
    Do Stuff
    Pause
}

Looks like there are only for loops available and no while loops in batch. How do I create an infinite loop then?

Answer

thkala picture thkala · Mar 30, 2011

How about using good(?) old goto?

:loop

echo Ooops

goto loop

See also this for a more useful example.