You could create a batch file that automatically starts the application, and if it stops, to start it again. Instead of running the program, you would run this file instead.
@Echo off
:Start
mGalaxy.exe
echo Program terminated at %Date% %Time% with Error %ErrorLevel% >> c:\logs\program.log
echo Press Ctrl-C if you don't want to restart automatically
timeout 10
goto Start
Core concept of this batch borrowed from SuperUser. Some edits mine.
Here's what each line does:
@Echo off
- Stops the command prompt from repeating every command
:Start
- This is a marker. We'll use this later to jump back to this point.
mGalaxy.exe
This starts the application, and waits for it to finish/quit.
- Note that this assumes that the application is in the same folder as your new batch file. If you want to keep the batch file elsewhere, you will need to add a folder path to this - Something like
"C:\Program Files\MAME\mGalaxy.exe"
echo Program terminated at %Date% %Time% with Error %ErrorLevel% >> c:\logs\program.log
- This is just a bit of logging if you want to figure out how often it crashes and potentially debug the possible cause. You can remove this if you wish
echo Press Ctrl-C if you don't want to restart automatically
- This outputs a reminder on how to quit the application (so you don't forget!)
timeout 10
- pauses the batch file for 10 seconds, giving you time to quit it before the application starts up again.
goto Start
- Returns the program to the 'Start' marker, effectively looping forever.
To create this batch file, open up Notepad, paste these commands, and Save as type 'Batch File (.bat
)', rather than .txt
.