天天看點

NSIS-解除安裝

BrandingText “www.xxx.cn”

Var UNINSTALL_PROG

Var OLD_VER

Var OLD_PATH

Function .onInit

!insertmacro MUI_LANGDLL_DISPLAY

ClearErrors

ReadRegStr $UNINSTALL_PROG ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} “UninstallString”

IfErrors done

ReadRegStr $OLD_VER ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} “DisplayVersion”

MessageBox MB_YESNOCANCEL|MB_ICONQUESTION

“檢測到本機已經安裝了 ${PRODUCT_NAME} $OLD_VER。

KaTeX parse error: Undefined control sequence: \n at position 1: \̲n̲\n是否先解除安裝已安裝的版本?”

/SD IDYES

IDYES uninstall

IDNO done

Abort

uninstall:

StrCpy $OLD_PATH $UNINSTALL_PROG -10

ExecWait ‘" U N I N S T A L L P R O G " / S ? = UNINSTALL_PROG" /S _?= UNINSTALLP​ROG"/S?​=OLD_PATH’ $0

DetailPrint “uninst.exe returned 0 " D e l e t e " 0" Delete " 0"Delete"UNINSTALL_PROG”

RMDir $OLD_PATH

done:

FunctionEnd