Link to home
Start Free TrialLog in
Avatar of Hardi
Hardi

asked on

How to open a key in RegEdit?

Is there any command line to open a key/value in RegEdit?

eg. I have the registry value
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir

I want to open RegEdit and it should show that value instead of the last key I opened.

I don't want any third party software. If there is no way, can we do it programatically in C#?
ASKER CERTIFIED SOLUTION
Avatar of Jinx_IT
Jinx_IT
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Hardi
Hardi

ASKER

Thanks a lot Jinx IT it really helps!

Just 1 more problem.
When I run the script it's alright, but when I do it in C# (my code below) I got UnauthorizedAccessException...
Any idea?
                RegistryKey tmpkey = Registry.CurrentUser.OpenSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Applets\Regedit");
                tmpkey.SetValue("LastKey", @"My Computer\"+path);

Open in new window

Nup sorry, cant help with that one :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial