问题
I'm making a small tool that can write a key in registry, and a tiny part of it just for convenience would be to navigate to that key instantly with the click of a button. I know how to open regedit.exe already but is there a way to instantly navigate to the key i need? I'm trying with
System.Diagnostics.Process.Start("regedit.exe" + "c/ HKEY_LOCAL_MACHINE");
but i think it's just trying to write a key into registry.
Thanks in advance!
Edit:
@Arran
-Actually the tool is for myself mainly. I'm still very much a newb at c# or programming in general, and I am learning it on my own. This program is 1/2 a test of what I can do and 1/2 a utility for my later work. My goal with this is to be able to write a key into registry and after that be able to navigate to it and delete it in seconds with out having to manually search through the regedit.
Edit:
@Hans Passant
Thank you for the information! I guess if it's that hard to implement, it's really not worth my time and effort.
回答1:
This thread is a bit old bit if anyone else ends up here by googling this works.
- Set LastKey to your path you want regedit to open in
- Launch regedit.
Example:
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);
}
来源:https://stackoverflow.com/questions/17453384/is-it-possible-to-open-regedit-and-navigate-to-straight-to-a-specific-key-using