开发者

Show that a failure has occurred and rollback or quit installer (NSIS)

开发者 https://www.devze.com 2023-01-24 11:39 出处:网络
开发者_Python百科If I try to install an MSI and it returns with an error code, how do I gracefully rollback or quit the installer?There is no automatic rollback, NSIS can\'t tell which of the operatio

开发者_Python百科If I try to install an MSI and it returns with an error code, how do I gracefully rollback or quit the installer?


There is no automatic rollback, NSIS can't tell which of the operations should be rolled back and how.

You have to deal with this yourself, either by rolling back each operation or starting your uninstaller in silent mode (ExecWait'"$instdir\youruninstaller.exe" /S _?=$instdir' (You must delete the uninstaller and $instdir after this))


I think that the Abort command might be the correct approach.


You can use:

ExecWait 'msiexec /i "$INSTDIR\something.msi"' $0
${If} $0 != '0' 
    MessageBox MB_OK|MB_ICONSTOP 'Install Failed!'
    Abort "Install failed"
${EndIf}    

Just like @Anders said you have to take care of the rollback by yourself

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号