在NSIS中制作安装程序/重新安装程序
我需要这个例程-如果显示带有安装路径的RegKey,我们必须停止已执行的应用程序(如果已执行),以静默方式启动卸载程序(如果未找到卸载程序-只需删除目录中的所有文件),并将INSTDIR设置为注册表中的值。 如果具有安装路径的注册表项不存在-开始正常安装在NSIS中制作安装程序/重新安装程序,nsis,Nsis,我需要这个例程-如果显示带有安装路径的RegKey,我们必须停止已执行的应用程序(如果已执行),以静默方式启动卸载程序(如果未找到卸载程序-只需删除目录中的所有文件),并将INSTDIR设置为注册表中的值。 如果具有安装路径的注册表项不存在-开始正常安装 ; Try to read Install Path from Reg ReadRegStr $0 HKCU "Software\TelnetTray" "Path" ; Uninstall first if app installed ${
; Try to read Install Path from Reg
ReadRegStr $0 HKCU "Software\TelnetTray" "Path"
; Uninstall first if app installed
${If} $0 != ""
!define INSTDIR $0
; Try to stop app if executed
Stop "$INSTDIR\app.exe"
; Try to uninstall
${If} ${FIleExists} "$INSTDIR\uninst.exe"
ExecWait "$INSTDIR\uninst.exe /S"
; Or just delete all files in INSTDIR
${Else}
Delete "$INSTDIR\*"
${EndIf}
${EndIf}
你差点就成功了
; Try to read Install Path from Reg
ReadRegStr $0 HKCU "Software\TelnetTray" "Path"
; Uninstall first if app installed
${If} $0 != ""
StrCpy $INSTDIR $0
; Try to stop app if executed
${nsProcess::CloseProcess} "$INSTDIR\app.exe" $R0
; Try to uninstall
${If} ${FIleExists} "$INSTDIR\uninst.exe"
ExecWait "$INSTDIR\uninst.exe /S"
; Or just delete all files in INSTDIR
${Else}
RMDir /r "$INSTDIR"
${EndIf}
${EndIf}
你做不到!定义INSTDIR$0,然后像那样使用$INSTDIR!谢谢@Anders!我注意到原来帖子上的错误,但忘了改正。固定的