Is there a way to run a [Code] procedure or PowerShell script in the Inno Setup compiler before the installation executable is generated?

  • We probably need more information. The compiler can be run from the command line so you could just put it at the end of the powershell script that you want to run then run that script. Having said all of that, this is not a programming problem question so it is off topic for stackoverflow.– EBGreenFeb 13 at 17:53

You may get better answers, if you explain what you need to run the code for. Anyway...


One way is to compile the script on command-line from a batch file:

powershell -file precompile.ps1ISCC.exe setup.isspowershell -file postcompile.ps1

(or you can call ISCC.exe from the PowerShell script itself)


Another way to run some script before compilation is using Exec preprocessor function.

#expr Exec("precompile.bat")

or

#expr Exec("powershell -file precompile.ps1")

See also Is it possible to call a batch file while compiling an Inno Setup script?


If you need a GUI solution, there's ISTool, an Inno Setup extension, that has direct support for Pre Compilation and Post Compilation "Steps". But this project is unfortunately no longer maintained. You might be able to update it to the latest Inno Setup version, as it is open source.

    Your Answer

     

    By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.