如何从另一个 NSIS 安装程序中执行 NSIS 卸载程序并等待其完成?
我有一个安装程序,一个编译的 NSIS 脚本,它首先检查系统上是否正在运行我的应用程序的另一个版本。如果存在另一个实例,则它首先触发静默卸载,然后继续安装新实例。
我使用 ExecWait 在静默模式下触发卸载程序,但我的主安装程序进程不会等待并继续安装过程。
如何强制主安装程序首先等待静默卸载完成?
I have an installer, a compiled NSIS script and it first checks if another version of my application is running on the system. If another instance exists, then it first triggers the silent uninstallation and then proceeds with installation of the new instance.
I use ExecWait
to trigger the uninstaller in the silent mode but my main installer process does not wait and goes ahead with the installation process.
How do I force the main installer to wait for the silent uninstallation to complete first?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用一个特殊的卸载程序参数(这样做的原因通常卸载程序需要能够删除自身)
There is a special uninstaller parameter you need to use (The reason for this is that normally the uninstaller needs to be able to delete itself)
这不仅仅是关于“ExecWait”。它还与“_?”有关,这是一条特殊的卸载程序指令。
实际上,在卸载过程中,uninstaller.exe 被复制到临时目录,然后从那里执行。
从临时目录复制并调用新卸载程序的这一步骤可能会很快,并且调用将立即返回,而无需实际等待卸载程序完成。
通过使用“_?”指示您告诉 NSIS 从同一位置运行卸载程序,而不是从临时目录运行。
除了“_?”之外,还使用“ExecWait”您告诉 NSIS 等待“卸载程序”过程完成然后返回。这样你就可以实现你所需要的。
请参阅http://nsis.sourceforge.net/Docs/Chapter3.html#3.2。 2 了解更多信息。
It is not just about "ExecWait". It is also about "_?", a special uninstaller instruction.
Actually, during uninstall the uninstaller.exe is copied to a temp directory and then executed from there.
This step of copying and invoking a new uninstaller from temp directory might be fast and the call would come back immediately without actually waiting for the uninstaller to complete.
By using "_?" instruction you tell NSIS to run the uninstaller from the same place and not from the temp directory.
By using "ExecWait" in addition to the "_?" you tell NSIS to wait for the "uninstaller" process to complete and then return. This way you achieve what you need.
refer http://nsis.sourceforge.net/Docs/Chapter3.html#3.2.2 for more information.