Archive: Detect pending reboot


Detect pending reboot
I have a setup that removes a previous installation of itself and installs again. So the scenario is this, you run the setup, it detects/uninstalls the previous installation, but it needs to reboot, even selecting "Reboot Now", it does not reboot, and goes on with the installation of the new one. Is there any way to avoid this, or detect a pending reboot from one setup to another?


Probably check rebootflag
From Help:

IfRebootFlag 0 noreboot
MessageBox MB_YESNO "A reboot is required to finish the installation. Do you wish to reboot now?" IDNO noreboot
Reboot
noreboot:


That was the first thing I tried, it didn't detect that a reboot was pending.


If you use an other exe to uninstall the previous installation, you'll need to create a file in your uninstaller or a registry key to tell your installer that a reboot is needed.


Just try creating a value in the RunOnce key, this way it will be removed after the reboot and if you check for it after your uninstaller runs, you'll be fine.


Writing a key to RunOnce is a good solution for me, it seems like it is working. Thanks!