windowsloopsbatch-fileinfinite-loop

How to create an infinite loop in Windows batch file?


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?


Solution

  • How about using good(?) old goto?

    :loop
    
    echo Ooops
    
    goto loop
    

    See also this for a more useful example.