开发者_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
精彩评论