c# - 如何删除注册表项?

标签 c# registry

我想在 C# 中运行此 DOS 命令,而不执行 DOS 命令。

REG DELETE HKLM\SOFTWARE\Wow6432Node\WindowsApplication1\Status /f

最佳答案

这是一种方法。请注意,您必须将 true 传递给 OpenSubKey 才能获得写入权限。

var hklm = Microsoft.Win32.Registry.LocalMachine;
var subkey = hklm.OpenSubKey("Software\\Wow6432Node\\WindowsApplication1", true);
subkey.DeleteSubKey("Status");

关于c# - 如何删除注册表项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29690461/

相关文章:

c# - vs 2017 asp.net core 2.2 中缺少上下文菜单来添加 Controller

c# - 带有 AngularJs (SPA) Web 界面的 DDD 项目……这是个好主意吗?

c# - 如何在 Windows 右键菜单中添加菜单项

windows - 如何创建行为类似于 .cmd/.bat 的文件扩展名?

c# - Xamarin - Customrenderer 出现 2 个错误

c# - 使用受限执行区域

c# - GridView 验证将整行标记为无效,而不仅仅是单元格

windows - 注册表中的参数扩展出现问题 | %~n1

powershell - REG_BINARY 到 PowerShell 中的 Windows 键

c# - 如何将凭据传递到计算机以便我可以在其上使用 Microsoft.Win32.RegistryKey.OpenRemoteBaseKey()?