Archive: Silent Reboot


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

Thank you
Rex


Use the Reboot instruction.


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


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?


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

and it does show a reboot dialog when in non-silent mode.


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.


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


A MessageBox will be a simpler test, which also works for me in my tests.


Thank you very much.
I figured it out now...
my very stupid mistake....

I had this in my code:
IfSilent +6
xxx


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...
:p


I am new to NSIS and not used to the + something syntax.
should use the ${If} ${else} instead...
thanks again for you help!


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.


thanks
I see, Comperio.
Thanks for you information.