我创建了一个注册表项值:
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")
它不起作用。我收到一个错误:“值不存在”...但该值存在于我的注册表中。
如何删除值(但不是键)?有什么想法吗?
答案 0 :(得分:0)
OpenSubKey设置为true,例如,如果您想要删除值:
Registry.CurrentUser.OpenSubKey(“Software \ Microsoft \ Windows \ CurrentVersion \ Run \”, True )。DeleteValue(“要删除的值”)