Automatically Restart Crashed Or Hanged Applications

Don’t you hate it when programs hang or crash? I find it especially annoying when a background application like an IM client or a bandwidth monitor silently crashes – sometimes I only notice the problem hours later when I’ve already missed a bunch of messages. I’m sure you’ve encountered a few “Not responding” errors and some irritatingly crash-prone applications yourself.

If you have an unstable program that you absolutely need to run at all times, but don’t want to waste your time monitoring and manually restarting it every time it croaks, I might have something interesting for you.

Restart on Crash is an monitoring tool that will watch the applications that you specify and automatically relaunch any program that hangs or crashes. You can add any number of applications to monitor, enable/disable them individually and edit the command line that will be used to restart an application.

Restart on Crash doesn’t require installation and stores all it’s configuration data in a “settings.ini” file in the program’s folder, so it’s portable. It should be compatible with most NT-based Windows versions.

Download Restart on Crash (1.4 MB)

Screenshots & Documentation

Main application window

The main window

  • To add a new application to monitor, click the “Add” button or press the Ins key.
  • To delete on or more applications from the list, select them and click “Delete” or press Del.
  • To edit the per-application configuration, double-click the corresponding row. This will open the editing dialog (see below).
  • You can also access the RoC configuration by clicking “Settings” and view the activity log by clicking “Show Log”. The log contains information about crashed/hanged applications, executed commands, and so on.
Editing the monitor settings for an application

Editing the monitor settings for an application

Well, this one should be pretty self-explanatory 🙂 One detail to keep in mind is that enabling the “It isn’t running” option will make Restart On Crash treat the application as if it has crashed even if you have purposefully it closed it. You can get around this by disabling the monitoring of the application before you close it.

The configuration dialog. Yes, that's it.

The configuration dialog. Yes, that’s it.

“Grace period” is how long Restart on Crash will wait before trying to terminate/restart an application that it has just terminated/restarted. This is intended to prevent a scenario where RoC kills a hanged program, restarts it, decides it has hanged again (e.g. if the program is non-responsive while starting up) and wrongfully terminates it again.

Known Issues

  • If you configure RoC to automatically kill a hanged application, it will terminate all instances of that application when doing so. This may be fixed eventually.

Release Notes


  • The “execute a command” feature can now launch shortcuts (.lnk files). Potentially, it can now run almost any type of file as long as file associations are set up correctly.


  • Improved “application is not responding” detection.
  • Added a “Clear Log” button to the Log window.


  • Added a “Restart Now” option to the application pop-up menu. It restarts the selected application immediately without waiting for the grace period to expire.
Related posts :

569 Responses to “Automatically Restart Crashed Or Hanged Applications”

  1. Jānis Elsts says:

    There are two things that RoC does to check if an application is responding:

    1. It sends one of the application windows a WM_NULL message with a 500 millisecond timeout. If the window does not process the message within the timeout, it is treated as “not responding”.

    2. If #1 works fine – that is, the application seems to be responding – RoC also uses the IsHungAppWindow Win32 API function to check if Windows thinks the application is not responding. See the link for more details about how that works. If the function returns “true”, RoC will treat the application as “not responding”.

    RoC does not take CPU usage into account at all.

    To kill an application, RoC uses a library method that (I think) calls TerminateProcess under the hood. This is a forceful way to stop an application. This approach was intentionally chosen because frozen/not responding applications might not react to more tactful solutions such as sending a WM_CLOSE message.

    Most likely, your app would not get a chance to log anything.

  2. Revo says:

    What is the option “Wait N seconds and double check”? What is its purpose?

  3. Jānis Elsts says:

    When the option is enabled and RoC detects that an application has crashed, it won’t immediately try to stop/restart the application. Instead, it will wait a short time – that is, the configured number of seconds. Then, if the application still looks like it has crashed, RoC will try to restart it.

    This is useful for applications that sometimes freeze for a while but then start working again later.

  4. Gumby says:

    Hi Janis,

    Thanks for RoC; been using it for years. Would you consider adding support for shortcut (.lnk) files to execute after a crash is detected? Shortcuts grant the ability to minimize a re-opened program while it could also be used to launch a (.vbs) batch script. As of v1.6.3.2, neither filetype is supported.

    An example of a helpful (.vbs) batch script would be to re-open the crashed program, while also running a second program that removes phantom icons that are left behind by RoC (via RefreshNotificationArea.exe). Logitech Gaming Software and USB Disk Ejector are two programs that leave phantom icons when forced to close by RoC. Having to wave the mouse over the systray to make them disappear manually isn’t a big deal, but it becomes a nuisance after hundreds\thousands of swipes, so a solution would really be nice.

    CMD batch files (.bat) *do* work, but CMD scripts always show a popup window when running, whereas (.vbs) scripts run quietly in the background, which is a much cleaner solution.

  5. Jānis Elsts says:

    I’ve rewritten the part of the code that executes commands and it should now be able to launch shortcuts. Hopefully, I didn’t break other kinds of commands in the process. Please give it a try.

  6. Gumby says:

    Thanks for adding .lnk support, Janis. Windows shortcuts now work as they should. I can now run command windows minimized and am no longer required to use a .bat to launch a .vbs script. RoC is literally perfect now.

  7. Vlad says:

    Thanks for the app. Unfortunately, it has bug that sometimes it doesn’t see that app crashed and doesn’t restart it even though the app is not present in the taskmgr process list.

  8. Jānis Elsts says:

    Unfortunately, that doesn’t seem to happen with any of the apps that I have tried, so I can’t really tell what’s causing that problem or how to fix it. It could be something that’s specific to a particular application.

  9. DJ says:

    Brilliant in its simplicity; does exactly what we need it to do. Thank you for sharing this!

Leave a Reply