如何在卸载 MSI 时删除单个注册表值?

发布于 2024-09-30 00:49:08 字数 475 浏览 0 评论 0原文

我的应用程序有时会在执行期间(即不在安装时)创建一个特定的注册表值。该值位于我不想删除的注册表项中;我只想删除我创建的值。因为它不是在安装时创建的,所以 Windows 安装程序在卸载时不会自动删除它。如果该值存在,我可以在 MSI 中做什么来删除它?

注册表表似乎没有这个选项。这是否意味着我必须编写自定义操作?如果是这样,有人有任何例子吗?

我正在使用 Wise Windows Installer Edition 来创建 MSI。

还发布于此处

There is a particular registry value that my application sometimes creates during execution, i.e. NOT at installation. This value is within a registry key that I don't want to delete; I just want to delete the value that I created. Because it's not created at install it's not automatically deleted at uninstall by windows installer. What can I do in the MSI to delete this value if it exists?

The Registry table doesn't seem to have this option. Does that mean I have to write a custom action? If so, anyone have any examples?

I'm using Wise Windows Installer Edition to create the MSI.

Also posted here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

简单 2024-10-07 00:49:08

抱歉,您需要自定义操作。

Sorry, you will need a custom action.

轻拂→两袖风尘 2024-10-07 00:49:08

您确实需要执行自定义操作。

我最终通过放置在 Deferred 部分中的 WriteRegistryValues 之后的自定义操作来实现此操作。

删除密钥的.vbs是这样的:

const HKLM = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Mozilla\Firefox\Extensions"
strValueName = "[email protected]"
oReg.DeleteValue HKLM,strKeyPath,strValueName

You do need to do a custom action.

I ended up implementing this with a custom action placed after the WriteRegistryValues within Deferred section.

The .vbs to delete the key is like this:

const HKLM = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Mozilla\Firefox\Extensions"
strValueName = "[email protected]"
oReg.DeleteValue HKLM,strKeyPath,strValueName
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文