简体   繁体   English

NSIS静默安装程序返回退出代码1

[英]NSIS silent installer returning exit code 1

I compile an NSIS script to a .exe install file. 我将NSIS脚本编译为.exe安装文件。 I launch the .exe with command line \\S silent option. 我使用命令行\\ S silent选项启动.exe。

Installation performs silently as wanted, but there is exit code 1. Exit code 1 corresponds to case with user choosing cancel on the wizard. 安装按需要静默执行,但是有退出代码1.退出代码1对应于用户在向导上选择取消的情况。 However, install is successful and mode is silent (no user interaction). 但是,安装成功并且模式是静默的(无用户交互)。 Also, where does this exit code comes from, and how to manually enforce an exit code 0? 此外,此退出代码来自何处,以及如何手动强制执行退出代码0?

I have an idea i could do something in .onInstSuccess function, to enforce an exit code 1 if installation is successful. 我有一个想法,我可以在.onInstSuccess函数中执行某些操作,如果安装成功,则强制执行退出代码1。

Also, ExecWait is capturing the exit code into a variable, but has got no 'set' option. 此外,ExecWait正在将退出代码捕获到变量中,但没有“set”选项。

What would you recommend? 你会推荐什么?

Thanks and regards 谢谢并恭祝安康

Without any sample code it is a bit hard to guess what the problem could be! 没有任何示例代码,有点难以猜测问题是什么!

You can set a specific exit code with SetErrorLevel . 您可以使用SetErrorLevel设置特定的退出代码。

As far as ExecWait goes, setting anything makes no sense, when it returns the child process has ended. 就ExecWait而言,设置任何东西都没有意义,当它返回子进程已经结束时。 If you want to use the exit code of a child process all you need is to get it: 如果您想使用子进程的退出代码,您只需要获取它:

ExecWait '"c:\foo.exe"' $0
SetErrorLevel $0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM