Skip to content
⌘ NSIS Forum Archive

Silent Reboot

13 posts

Guest#

Silent Reboot

Could someone please tell me how to do a reboot during a silent mode installation?

Thank you
Rex
Guest#
thanks but...

thanks but I tried this and the reboot flag is not somehow unset:
If .onInstSuccess is not the place to do the Reboot, where else?

Function .onInstSuccess
Ifsilent 0 +3
IfRebootFlag 0 +2
Reboot
FunctionEnd
kichik#
The Reboot instruction reboots the computer. If the reboot flag isn't set, it's another story. Have you set it using the SetRebootFlag instruction, Rename /REBOOTOK, Delete /REBOOTOK or RMDir /REBOOTOK?
Guest#
yes

yes, for testing purpose, I have set it through:
SetRebootFlag true

and it does show a reboot dialog when in non-silent mode.
kichik#
Does it actually reboot in non-silent mode? Maybe there's a program running in the background which is denying a reboot when it gets WM_QUERYENDSESSION. For example, non-silent NSIS installer do that.
Guest#
well, actually, I just tested if the reboot statement is even being executed by replacing it with ExecShell. And it never opened the readme file:

Function .onInstSuccess
Ifsilent 0 +3
IfRebootFlag 0 +2
ExecShell "open" "c:\readme.txt" ;Reboot
FunctionEnd
Guest#
Thank you very much.
I figured it out now...
my very stupid mistake....

I had this in my code:
IfSilent +6
xxx
Guest#
Thank you very much.
I figured it out now...
my very stupid mistake....

I had this in my code:
IfSilent +6
xxx
xxx
xxx
xxx
xxx
SetRebootFlag true

and the SetRebootFlag is not called in silent mode...
😛
Guest#
I am new to NSIS and not used to the + something syntax.
should use the ${If} ${else} instead...
thanks again for you help!
Comperio#
The +[number] statement tells the installer to jump ahead that number of lines. (you can use a negative number if you want to jump backward.) Search for the GOTO command in the help files for more info on this concept.

The ${If}/${Else} command set basically does the same thing as does GOTO label command. Use whichever works the easiest for you.