Run a [Code] or PowerShell script in Inno Setup compiler

回眸只為那壹抹淺笑 提交于 2020-01-09 05:33:22

问题


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


回答1:


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.ps1

ISCC.exe setup.iss

powershell -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.



来源:https://stackoverflow.com/questions/48772183/run-a-code-or-powershell-script-in-inno-setup-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!