Uninstall注册表项

来源:互联网 发布:17173捏脸数据 编辑:程序博客网 时间:2024/05/29 14:11

64位:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\

32位:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

提供卸载程序的方法

;写注册表,以便在“添加/删除程序”中显示

    WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""DisplayName" "${Name} ${Ver}"
    WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""UninstallString" "$INSTDIR\UnInstall.exe"
   ;以下可选
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""InstallLocation" "$INSTDIR"
    WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""DisplayIcon" "$INSTDIR\install.ico"
    WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""Publisher" "${CmpName}"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""ModifyPath" "$INSTDIR\Uninstall.exe"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""InstallSource" "$INSTDIR"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""ProductID" "(产品ID)" ;产品ID
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""RegOwner" "${CmpName}" ;已注册的所有者
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""RegCompany" "${CmpName}" ;已注册的公司
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""HelpLink" "http://" ;技术支持信息
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""HelpTelephone" "800-" ;支持电话
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""URLUpdateInfo" "http://" ;产品更新
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""URLInfoAbout" "http://cmp" ;公司网址
    WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""DisplayVersion" "${Ver}"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""VersionMajor" "2"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""VersionMinor" "3234"
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""NoModify" 1 ;-1有,1无
    ;WriteRegStrHKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${Name}""NoRepair" 1 ;同上

   ;写卸载程序
   WriteUninstaller "$INSTDIR\UnInstall.exe"


C.3 向“添加/删除程序”添加卸载信息
在“ HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall”下创建一个以你的产品名为名的项,就可以向“控制面板”中的“添加/删除程序”添加一个条目。对于Windows NT (NT4/2000/XP),可能还要在 HKCU下创建项,而且这将只能显示给当前用户。这里有许多可以写入关于你的应用程序和卸载程序的信息的值项。可以通过WriteRegStr 或是 WriteRegDWORD 命令写入一个值。例如:

WriteRegStr HKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\Product""DisplayName" "Application Name"
必需值

DisplayName (字符串)- 应用程序的名称
UninstallString (字符串)- 卸载程序的路径和文件名。你应当 总是给路径加上引号,以确保路径中的空格不会令 Windows无法找到卸载程序。

可选值

以下某些值将不会被旧版本的 Windows 使用。

InstallLocation (字符串)- 安装目录 ($INSTDIR)
DisplayIcon (字符串)-将要显示于你的应用程序名称旁边的图标的路径,文件名和索引。

Publisher (字符串)- 发布者(或公司)的名称

ModifyPath (字符串)- 应用程序的修复程序的路径和文件名。
InstallSource (字符串)- 应用程序的安装路径。

ProductID (字符串)- 应用程序的产品 ID。
RegOwner (字符串)- 应用程序的注册拥有者。
RegCompany (字符串)- 应用程序的注册公司。

HelpLink (字符串)- 技术支持的网站链接。
HelpTelephone (字符串)- 技术支持电话。

URLUpdateInfo (字符串)- 应用程序的在线更新网址链接。
URLInfoAbout (字符串)- 应用程序的主页链接。

DisplayVersion (字符串)- 应用程序的显示版本。
VersionMajor (DWORD)- 应用程序的主版本号。
VersionMinor (DWORD)- 应用程序的副版本号。

NoModify (DWORD)- 1 (如果卸载程序没有修改应用程序的选项)
NoRepair (DWORD)- 1 (如果卸载程序没有修复安装程序的选项)

如果“NoModify”和“NoRepair”都被设为 1,那么按钮将会用“删除”代替“修改/删除”。


0 0