运行 Inno Setup 编译器中的 [代码] 或 PowerShell 脚本

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

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

如果您向 运行 代码解释您需要做什么,您可能会得到更好的答案。不管怎样...


一种方法是从批处理文件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 解决方案,有一个 Inno Setup 扩展 ISTool,它直接支持预编译和 Post 编译 "Steps"。但不幸的是这个项目已经不再维护了。您可以将其更新到最新的 Inno Setup 版本,因为它是开源的。