简体   繁体   English

即使具有管理员权限也无法删除注册表项

[英]Cannot Delete Registry Entry even with Admin Rights

I have the following registry entry SOFTWARE\\\\mysoftware\\\\" in the localmachine 我有以下注册表项SOFTWARE\\\\mysoftware\\\\"localmachine

There are several subfolders and values within it.I just want to remove SOFTWARE\\\\myspftware\\\\ 其中有几个子文件夹和值。我只想删除SOFTWARE\\\\myspftware\\\\

So i use 所以我用

 Registry.LocalMachine.DeleteSubKeyTree("SOFTWARE\\mysoftware\\");

in a program with admin rights. 在具有管理员权限的程序中。 I keep getting the error 我不断收到错误

Cannot delete a subkey tree because the subkey does not exist.

even though the key exists. 即使密钥存在。

Try 尝试

RegistryKey mykey = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
mykey.DeleteSubKeyTree("mysoftware");
mykey.Close();

I think the true in Registry.LocalMachine.OpenSubKey("SOFTWARE", true) is the magic part. 我认为trueRegistry.LocalMachine.OpenSubKey("SOFTWARE", true)是魔法的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM