chriscrutt
chriscrutt

Reputation: 529

Auto restart batch file upon exit from batch

Currently I have a batch file running:

cd "C:\Users\chriscrutt\Desktop\"
:loop
Start /w yeet.bat
goto loop

This runs "yeet.bat". Sometimes the command prompt will crash but I need it to automatically restart. That is why I used "/w" but it requires me to manually input "N" when it asks: Terminate batch job (Y/N)? Is there a way to make it so it automatically restarts or so it will automatically say "N" to restart it?

This is how it goes. I run the bat file which runs the yeet file which runs the other program. the code for "yeet.bat" is

title ETHBTC
cd "C:\Users\chriscrutt\Google Drive\gekkoETHBTC"
node gekko

When i do "node gekko" it runs the bot.

Upvotes: 4

Views: 15440

Answers (1)

Aacini
Aacini

Reputation: 67256

This code do what you want: each time that yeet.bat ends for any reason it is restarted again "immediately and automatically".

cd "C:\Users\chriscrutt\Desktop\"
:loop
Start yeet.bat | set /P "="
goto loop

Upvotes: 8

Related Questions