1
我是NSIS的新手,但是我想在安裝新版本的同時對已安裝的舊版本進行檢查。我完全像我在這裏找到的那樣 - http://nsis.sourceforge.net/Auto-uninstall_old_before_installing_new但是因爲我需要檢查是否安裝了舊版本才能正確卸載,所以我將InstallLocation註冊表值添加到安裝進度中。在安裝新版本之前卸載舊版本
如果我使用ExecWait'$ R0 _?= $ INSTDIR'並且舊版本的安裝文件夾與INSTDIR相同,則一切正常。但是,如果我使用ExecWait'$ R0 _?= $ R1',它會給我NSIS安裝程序錯誤,但我無法找到問題出在哪裏,我做錯了什麼?
有人可以幫忙嗎? 感謝
登記由該補充道:
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" "InstallLocation" '"$INSTDIR"'
的功能代碼:
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" \
"UninstallString"
StrCmp $R0 "" done
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${AppName} is already installed. $\n$\nClick OK to remove the \
previous version or Cancel to cancel the installation." \
IDOK uninst
Abort
;Run the uninstaller
uninst:
ReadRegStr $R1 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${AppName}" \
"InstallLocation"
ClearErrors
HideWindow
ClearErrors
ExecWait '$R0 _?=$R1'
BringToFront
done:
functionEnd
對不起,但您能告訴我究竟應該在哪裏刪除這些引號嗎?我不明白。 – madleeen
'「$ INSTDIR」',無論是在WriteRegStr調用中,還是在ReadRegStr – Anders
之後使用strcmp + strcpy很酷,謝謝,它工作正常。 – madleeen