检测NSIS是否已安装程序 [英] Detecting if a program is already installed with NSIS
本文介绍了检测NSIS是否已安装程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用NSIS为程序创建安装程序,那么检测该程序是否已安装的最佳方法是什么?另外,由于我是从autorun.inf运行安装程序,因此如果找到已安装的副本,是否可以立即退出安装程序?
I'm using NSIS to create an installer for a program, what is the best way to detect if this program is already installed? Also, since I'm running the installer from the autorun.inf, can I immediately quit the installer if it locates an installed copy? Is there a better way to do this?
推荐答案
如何解决?
我在一个旧的NSIS脚本中放了这个。
How about this. I had this in an old NSIS script laying around.
; Check to see if already installed
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\<YOUR-APP-NAME>" "UninstallString"
IfFileExists $R0 +1 NotInstalled
messagebox::show MB_DEFBUTTON4|MB_TOPMOST "<YOUR-APP-NAME>" \
"0,103" \
"<YOUR-APP-NAME> is already installed." \
"Launch Uninstall" "Cancel"
Pop $R1
StrCmp $R1 2 Quit +1
Exec $R0
Quit:
Quit
NotInstalled:
这篇关于检测NSIS是否已安装程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文