Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 938
chriscrutt Avatar asked Sep 13 '25 07:09

chriscrutt


1 Answers

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
like image 112
Aacini Avatar answered Sep 15 '25 14:09

Aacini