简体   繁体   English

从卸载部分NSIS重新执行安装

[英]Reexecute the installation from the uninstall section NSIS

I have a NSIS code that install a program , in .onInit I check if an older version did exist and uninstall it if the user click on OK button, I want that once the uninstallation finish the installation re execute again, I try to call .onInit in un.onUninstSuccess function but it didn't accept it since un. 我有一个NSIS代码来安装程序,在.onInit中,我检查是否存在较旧的版本,如果用户单击“确定”按钮,则将其卸载,我希望一旦卸载完成,安装将再次执行,请尝试调用.onInit函数中的un.onUninstSuccess但自un.以来不接受un. function accepts only un. 函数仅接受un. function. 功能。 Any idea will be appreciated. 任何想法将不胜感激。

This is not the way to do. 这不是方法。 When you start the uninstaller, you start another process (typically uninstall.exe ) so you cannot just jump from it to the installer. 启动卸载程序时,您将启动另一个进程(通常是uninstall.exe ),因此您不能仅从它跳转到安装程序。

What you can do is: 您可以做的是:

  • check if the previous version is present 检查是否存在以前的版本
  • if so, start its unistall.exe while waiting for the subprocess to complete 如果是这样,请在等待子进程完成的同时启动其unistall.exe
  • once you are back in the installer, continue your installation 返回安装程序后,继续安装

A usual way to call the uninstaller from the setup is 从设置中调用卸载程序的常用方法是

ExecWait '"$INSTDIR\uninstaller.exe" /S _?=$INSTDIR'

可能不是最干净的解决方案,但是nsis Wiki上有一个组合的un / installer示例

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

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