是否可以打开 regedit 并使用 process.start 直接导航到特定键?

Wol*_*fyD 4 c# registry regedit process.start

我正在制作一个可以在注册表中写入一个键的小工具,为了方便起见,其中的一小部分是通过单击按钮立即导航到该键。我已经知道如何打开 regedit.exe 但有没有办法立即导航到我需要的密钥?我正在尝试

System.Diagnostics.Process.Start("regedit.exe" + "c/ HKEY_LOCAL_MACHINE");

但我认为它只是试图将一个密钥写入注册表。

提前致谢!

编辑:

@阿兰

-其实这个工具主要是给我自己用的。我仍然是 C# 或编程方面的新手,我正在自己学习。这个程序 1/2 是我能做什么的测试,1/2 是我以后工作的实用程序。我的目标是能够将一个密钥写入注册表,然后能够导航到它并在几秒钟内将其删除,而不必手动搜索 regedit。

编辑:

@汉斯帕桑特

感谢您的信息!我想如果它很难实施,那真的不值得我花时间和精力。

nic*_*ren 5

如果其他人通过谷歌搜索这个作品最终到达这里,这个线程有点老了。

  1. 将 LastKey 设置为您希望 regedit 打开的路径
  2. 启动注册表。

例子:

var registryLocation =  "Your key here";
var registryLastKey = @"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit";           
    try
    {
        Registry.SetValue(registryLastKey, "LastKey", registryLocation); // Set LastKey value that regedit will go directly to
        Process.Start("regedit.exe");
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }
Run Code Online (Sandbox Code Playgroud)