如何在 Inno Setup 中设置退出代码?
我想为我的安装设置退出代码,这样我就能知道为什么安装被中止。我正在使用 Inno Setup。
I want to set the exit code for my installation, this way I will know why the installation was aborted. I'm using Inno Setup.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
来自 Inno Setup 帮助文档(来自文章“安装程序退出代码” ):
您可以通过确认退出代码为
0
轻松检查设置是否成功运行。此外:要更具体地回答您的问题,您可以通过观察退出代码
2
或5
来确定安装已取消。如果您希望在 Inno 返回
0
时返回自定义退出代码,您可以定义以下事件函数:来自帮助文档 (摘自文章“Pascal 脚本:事件函数”):
From the Inno Setup Help document (from the article "Setup Exit Codes"):
You can easily check if the setup ran successfully by confirming that the exit code is
0
. Furthermore:To answer your question more specifically, you can determine the installation was canceled by observing exit code
2
or5
.If you wish to return a custom exit code when Inno would otherwise return
0
, you can define the following event function:From the help document (from the article "Pascal Scripting: Event Functions"):
使用:
Use:
确实有同样的问题并找到了解决方法:
现在在设置的任何时候只需将 CustomExitCode 设置为您想要的代码即可。
示例:
这样安装程序就不会突然终止,并且无论向导以何种状态退出,您都可以自定义退出代码。
Did have this same question and found a way to it:
And now at any point of your setup just set CustomExitCode to the code you want.
Example:
This way the setup will not terminate abruptly and you can customize the exit code no matter what state the wizard did exit.