在Inno Setup编译器中运行[Code]或PowerShell脚本

时间:2018-02-13 17:14:28

标签: powershell inno-setup pascalscript

在生成安装可执行文件之前,有没有办法在Inno Setup编译器中运行[Code]过程或PowerShell脚本?

1 个答案:

答案 0 :(得分:1)

如果您解释运行代码所需的内容,您可能会得到更好的答案。反正...

一种方法是从批处理文件中compile the script on command-line

powershell -file precompile.ps1

ISCC.exe setup.iss

powershell -file postcompile.ps1

(或者您可以从PowerShell脚本本身调用ISCC.exe

在编译之前运行某些脚本的另一种方法是使用Exec preprocessor function

#expr Exec("precompile.bat")

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

另见Is it possible to call a batch file while compiling an Inno Setup script?

如果你需要一个GUI解决方案,那么ISTool是一个Inno Setup扩展,它直接支持Pre Compilation和Post Compilation" Steps"。但不幸的是,这个项目不再维持。您可以将其更新为最新的Inno Setup版本,因为它是开源的。