我创建了一个注册表项值:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "TestApp", "C:\myapp.exe")
效果很好,值在注册表中。我试图删除它
My.Computer.Registry.CurrentUser.OpenSubKey("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run").DeleteValue("TestApp")
和
My.Computer.Registry.CurrentUser.DeleteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\TestApp")
这没用。我收到一个错误:“值不存在”...但该值存在于我的注册表中。
如何删除值(而不是键)?有任何想法吗?
如果您需要对密钥进行写访问,则 OpenSubKey 设置为 true,例如,如果您想要删除值:
Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run\", True ).DeleteValue("要删除的值")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句