How to restart my application if Windows Update forces a reboot? How to restart my application if Windows Update forces a reboot? windows windows

How to restart my application if Windows Update forces a reboot?


I think the RegisterApplicationRestart Win32 API function might be what you're after, it's part of the Restart Manager API.


If you have Windows Vista or Windows 7, you can use the Managed Restart and Recovery API. The links on that page also point to some useful blog entries

http://channel9.msdn.com/posts/DanielMoth/Windows-Vista-Restart-amp-Recovery-APIs-from-managed-code/


A simple way is to add an entry to the following registry key :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

Just create a value containing the path of your app (optionally including command line arguments). The app will be run at the next startup, then the value will be deleted.