PDA

View Full Version : #00003: How to Reboot and Continue



FAQ
01-20-2006, 04:01 AM
Question:

How to create a setup that reboots during a certain point in the install. After the reboot, the setup launches again and continues on from the same location it left off from.

Answer:

This can done by making an entry into the RunOnce key in the registry. The RunOnce key contains the path to the installation setup.exe file so that it starts again after reboot. The RunOnce key path also includes a /V REBOOTED 1 command line switch to set the runtime installer variable %REBOOTED% to 1 so that you can easily detect if the setup.exe was executed by the RunOnce key. Then using the %REBOOTED% variable, you can skip through code that was executed during the initial installation.

Set Variable %REBOOTED% to 0
Set Variable %INSTALLERFILENAME% to ScriptItem->Get System Information(Installer File Name)

If %REBOOTED% Equals "0" Then

! /V REBOOTED 1 to skip reboot process
Add RegistryRunOnce Entry "%INSTALLERFILENAME% /V REBOOTED 1"
Display Message Box "--- Only Displayed Before Reboot ---\n" -- "SetupBuilder 5"
Reboot Computer SystemEnd

Display Message Box "--- Only Displayed After Reboot ---\n" -- "SetupBuilder 5"

Date: 01/20/2006