Inno Setup: restart in the middle of setup process

后端 未结 1 889
谎友^
谎友^ 2021-01-01 01:26

I\'ve made a installer via Inno Setup and now I\'m need to restart computer after some files were run.

So, i have code:

....
[Files]
....
[Run]
Filen         


        
相关标签:
1条回答
  • 2021-01-01 01:58

    Have a look at the CodePrepareToInstall.iss example script included with Inno. It shows how to arrange for a reboot and have the installation automatically resume afterwards. (You may need to make further changes or save further values if your installation is more complex or prompts for further user input.)

    The missing link in that example is that you need to fill in the DetectAndInstallPrerequisites function by using ExtractTemporaryFile to retrieve the appropriate files (as it runs before the main [Files] section is processed) and Exec(ExpandConstant('{tmp}\yourfile.exe'), ...) to actually run the file. If this is a subinstaller you can then check its exit code to determine if a reboot is actually required or not rather than unconditionally requesting a reboot.

    Note that this code will be executed again following the reboot, so you also need some way to detect that the subinstall has succeeded and skip trying to run it again. Typically this is done by trying to detect the version of the installed subcomponent.

    0 讨论(0)
提交回复
热议问题