Open specified path in registry
Hello,
I want to open the specified location in Registry using VB.NET similar
Registry Favorite, how to do?
The regedit.exe can not open specified location.
Here the code i tried.
Code:
Dim rKey As RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products", True)
Process.Start("regedit.exe")
Thank you
Re: Open specified path in registry
Quote:
Process.Start("regedit.exe")
Well clearly that won't do because there is no command line argument to direct it. Unfortunately however, no such command line argument exists so you cannot open regedit to a specific key in this way. You could automate adding a new favourite and/or the choice of an existing favourite (though I'm far from convinced it's worth the effort).
Re: Open specified path in registry
Your code does two things.
1. Gives your application access to a RegistryKey (see here)
2. Opens a program
These are 2 seperate things that have nothing in relation to each other. Are you trying to "jump" to that location using the Regedit application?
Re: Open specified path in registry
I need the code from my code.
I want to open a registry key from the path
After entering the code to textbox using a full of registry key and jump to key in a registry.
Re: Open specified path in registry
Quote:
Originally Posted by
dunfiddlin
You could automate adding a new favourite and/or the choice of an existing favourite (though I'm far from convinced it's worth the effort).
This is the crux of the matter right here. The effort required would hardly be worth it. Why do you want to do this ? Perhaps the problem this is meant to solve has a much less painful solution.
Re: Open specified path in registry
Am i right in thinking you want to "Jump" to a key when regedit opens? I know there is a favorite menu but what about setting the LasyKey.
Re: Open specified path in registry
@ident: Great minds... I was just playing with that.
Tested on Windows 7. No idea about anything else.
Have to make sure RegEdit.exe isn't already running , or it doesn't seem to work. And leaving a trailing "\" on the target key path seems to stop the key's contents from displaying. (possibly doesn't bode well, lol)
Code:
Imports Microsoft.Win32
Private Sub Button1_Click(sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DisplayRegKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer")
End Sub
Private Sub DisplayRegKey(regKeyToDisplay As String)
regKeyToDisplay.TrimEnd("\"c)
Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit", "LastKey", regKeyToDisplay, RegistryValueKind.String)
' RegEdit.exe not to be running already
For Each p As Process In Process.GetProcessesByName("regedit")
p.Kill()
Next
Process.Start("regedit.exe")
End Sub
Re: Open specified path in registry
Works fine on XP Inferrd, Good job.
Re: Open specified path in registry
Interesting approach. That's pretty clever.
Re: Open specified path in registry
Awesome ;)
Thanks for your help.
Re: Open specified path in registry
Re: Open specified path in registry
work fine on all windows great work buddy thanks