在 Inno Setup 编译器中运行 [Code] 或 PowerShell 脚本 [英] Run a [Code] or PowerShell script in Inno Setup compiler

查看:60
本文介绍了在 Inno Setup 编译器中运行 [Code] 或 PowerShell 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

推荐答案

如果您解释运行代码的目的,您可能会得到更好的答案.无论如何...

一种方法是在命令行上编译脚本批处理文件:

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

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

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

另一种在编译前运行脚本的方法是使用 Exec 预处理函数.

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

#expr Exec("precompile.bat")

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

另见是否可以在编译 Inno Setup 脚本时调用批处理文件?

如果您需要 GUI 解决方案,可以使用 ISTool,这是一个 Inno Setup 扩展,具有直接支持预编译和后编译步骤".但不幸的是,该项目已不再维护.您可以将其更新到最新的 Inno Setup 版本,因为它是开源的.

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.

这篇关于在 Inno Setup 编译器中运行 [Code] 或 PowerShell 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆