I said multiple sections and you are not even trying. You are also missing some Pop's in that code...
Try https://nsis.sourceforge.io/Reboot_and_Continue
Announcement
Collapse
No announcement yet.
Restart machine and continue
Collapse
X
-
Hi,
Thanks for your reply. I have a sample script like:
!include "MUI.nsh"
; include first in order to enable LogicLib support
!include "LogicLib.nsh"
!include "WinVer.nsh"
!addplugindir "Plugins\"
RequestExecutionLevel user
ShowInstDetails show
Section
SetOutPath $INSTDIR\${APPLICATION_DIR}
ExpandEnvStrings $0 %COMSPEC%
nsExec::ExecToStack '"C:\path-tobatch-file\commands.bat"'
nsExec::ExecToStack '"C:\path-tobatch-file\Test.bat"'
nsExec::ExecToStack 'C:\Windows\Sysnative\WindowsPowerShell\v1.0\powershell.exe -inputformat none -ExecutionPolicy RemoteSigned -File ""$EXEDIR\SysInfo.ps1""'
Pop $R0 # return value/error/timeout
Pop $R1 # printed text,
SectionEnd
Here after commands.bat the system will restart and after restart the nsi script should start from Test.bat onwards.
Can u give me sample script to handle this since am new to NSI scripting.
Leave a comment:
-
-
Ideally you would just configure everything and then reboot but if you must...
You need to structure your script into multiple Sections. When you get to the reboot point, write a RunOnce registry entry and then reboot. After rebooting, detect this incomplete state and use Sections.nsh to disable the Sections you already completed. You also have to skip the pages before InstFiles.
Depending on what you are doing, it might be easier to create a helper .exe to perform the post reboot actions instead.
Caveats: RunOnce will not complete until an admin logs in.
Leave a comment:
-
-
Restart machine and continue
Hi,
I have installer.nsi File where i call multiple .bat scripts.
So i have requirement like after installing some drivers i need to restart the system and after restart i need to continue from the step where it is stopped, i don't want to stop from beginning.
Is there any way i can do it from Nsi scripts? I have to continue from the scripts where it stopped not from the beginning of NSI script.
Leave a comment: