Page 1 of 1
How to force computer to reboot
Posted: Tue Dec 02, 2008 7:51 pm
by get101
I have a script that writes a registry key. At the end of the install, I want to force a reboot.
I tried this but it didn't reboot:
Apply Install (get result into variable SUCCESS)
Set Variable REBOOTCOMPUTER to TRUE
How do I force a reboot?
Posted: Tue Dec 02, 2008 8:27 pm
by CandiceJones
Studying the code at the end of the install:
Comment: End of Installation
Hide Dialog
Display Dialog: finish, wait for dialog to return (modal)
if Variable SILENT Equals FALSE
if Variable REBOOTCOMPUTER Equals TRUE
if Variable SUCCESS Equals REBOOT
Reboot Computer
end
end
if Variable RUNAPP Equals TRUE
if Variable REMOVE Equals FALSE
if Variable SUCCESS Equals COMPLETE
Run Program $TARGETDIR$\\mta.exe
Comment: TO-DO: Insert command that starts your application here
end
end
end
end
<<Code>>
We find the solution to be setting SUCCESS to TRUE as well.
Posted: Tue Dec 02, 2008 10:12 pm
by get101
Candice, you said:
We find the solution to be setting SUCCESS to TRUE as well.
Did you mean: We find the solution to be setting SUCCESS to REBOOT as well.
If yes, does this look OK:
Code: Select all
if Variable ADVERTISE Equals TRUE
Apply Advertised (get result into variable SUCCESS)
else
Apply Install (get result into variable SUCCESS)
Comment: Force a reboot after installing key!
Set Variable REBOOTCOMPUTER to TRUE
Set Variable SUCCESS to REBOOT
end
Posted: Wed Dec 03, 2008 4:52 am
by CandiceJones
Yes of course silly me, sorry!
The code does look OK but for good measure I would ONLY mandate the reboot if SUCCESS is NOT ERROR or CANCEL.