|
-
Aug 29th, 2013, 10:12 AM
#1
Thread Starter
Addicted Member
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
-
Aug 29th, 2013, 10:28 AM
#2
Re: Open specified path in registry
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).
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
Aug 29th, 2013, 10:28 AM
#3
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?
-
Aug 29th, 2013, 02:13 PM
#4
Thread Starter
Addicted Member
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.
-
Aug 29th, 2013, 02:56 PM
#5
Re: Open specified path in registry
 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.
-
Aug 29th, 2013, 03:42 PM
#6
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.
Last edited by ident; Aug 29th, 2013 at 04:04 PM.
Reason: Not needed extra
-
Aug 29th, 2013, 03:59 PM
#7
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
-
Aug 29th, 2013, 04:04 PM
#8
Re: Open specified path in registry
Works fine on XP Inferrd, Good job.
-
Aug 29th, 2013, 04:44 PM
#9
Re: Open specified path in registry
Interesting approach. That's pretty clever.
-
Aug 30th, 2013, 04:05 AM
#10
Thread Starter
Addicted Member
Re: Open specified path in registry
Awesome 
Thanks for your help.
-
Aug 30th, 2013, 05:17 AM
#11
Re: Open specified path in registry
-
Feb 19th, 2014, 04:50 AM
#12
Thread Starter
Addicted Member
Re: Open specified path in registry
work fine on all windows great work buddy thanks
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|