我当前正在使用以下脚本来安装驱动程序和我的应用程序:
!macro customInstall
ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
!macroend
但是,如果 DPInst
返回 >= 0x80010000
,这意味着一个或多个驱动程序安装失败,因此我需要回滚安装并退出。知道我该怎么做吗?
最佳答案
ExecWait可以将进程退出代码存储在第二个参数中。您无法执行太多操作来回滚它,最好在安装阶段尽早执行此操作:
!include LogicLib.nsh
Section
SetOutPath "$instdir\resources"
File "whatever\DPInst.exe"
ExecWait '"$INSTDIR\resources\DPInst.exe" /sw' $0
${If} $0 U>= 0x80010000
Delete "$INSTDIR\resources\DPInst.exe"
RMDir $instdir\resources
RMDir $instdir
MessageBox mb_iconstop "Error blah blah"
Abort
${EndIf}
SectionEnd
关于如果 ExecWait 命令获取特定返回代码,则 NSIS 回滚安装程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43743389/