简体   繁体   中英

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. function accepts only 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.

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
  • 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示例

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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