+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, How to jump to the desired registry key with one click in Coding and Web Development; The second cool thing I have found off this blog that I think needs reposting How to jump to the ...
  1. #1

    SYNACK's Avatar
    Join Date
    Oct 2007
    Thank Post
    Thanked 2,743 Times in 2,317 Posts
    Blog Entries
    Rep Power

    How to jump to the desired registry key with one click

    The second cool thing I have found off this blog that I think needs reposting

    How to jump to the desired registry key with one click | Winaero

    Since Windows 2000, the Registry Editor is able to remember the last opened key before you closed it. This data is stored at the following registry key:

    HKEY_Current_User\Software\Microsoft\Windows\Curre ntVersion\Applets\Regedit
    The LastKey value is used by Windows to store the last used key.

    As you can see, this is a per-user registry branch, so Windows stores the last used key for every user separately. It is possible to utilize this feature to directly jump to the key you need. Let me show how it can be done via Windows Scripting Host and VBScript.

    The Implementation

    The idea is to copy the full path of the desired registry key to the clipboard and replace the LastKey value with the copied value from the clipboard. When regedit.exe is started after doing this, it will open directly at the key you want.

    How to fetch clipboard content with VBscript

    The "htmlfile" ActiveX object is used to display HTML help and HTA files in Windows. It can be used to fetch clipboard content. It does not even require IE to be installed . The code is as follows:

    set objHTA=createobject("htmlfile")
    cClipBoard=objHTA.parentwindow.clipboarddata.getda ta("text")

    If clipboard content is text, it will be stored in cClipBoard variable. Simple, isn't it?

    Directly opening Regedit at desired key

    Since we now have the desired key in cClipboard, we have to write it into LastKey value metioned above. The code for that is:

    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Ap plets\Regedit\LastKey", сClipBoard, "REG_SZ"

    This code snippet is self-explanatory, so there is no need to comment it.

    The final script looks like this:

    Dim objHTA
    Dim cClipBoard
    Dim WshShell
    set objHTA=createobject("htmlfile")
    cClipBoard=objHTA.parentwindow.clipboarddata.getda ta("text")
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Ap plets\Regedit\LastKey", cClipBoard, "REG_SZ"
    WshShell.Run "regedit.exe -m"
    Set objHTA = nothing
    Set WshShell = nothing

    Note that WshShell.Run "regedit.exe -m" line. It contains the undocumented "-m" switch, which allows you to run multiple instances of Regedit simultaneously.

    I have saved this script as "RegNav.vbs" file and you can download it right now:

    Download ready to use VB Script

    If opening Regedit is a very frequent task for you, then you can pin regnav.vbs to the taskbar. Create a new shortcut and type the following into the shortcut target text box:

    wscript.exe d:\regnav.vbs
    Don't forget to use the correct path to regnav.vbs.

    Now right click on the shortcut file you have created and click "Pin to Taskbar" from the context menu. That's all.

    P.S. How to test this script

    Select this text
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
    Press CTRL+C
    Click on regnav.vbs.

  2. Thanks to SYNACK from:

    penfold (29th July 2014)

  3. #2

    Join Date
    Apr 2009
    Thank Post
    Thanked 1 Time in 1 Post
    Rep Power
    It seems as if Sysinternals' 'regjump' program is still available: http://live.sysinternals.com/regjump.exe

+ Post New Thread

Similar Threads

  1. Replies: 2
    Last Post: 10th December 2013, 04:30 PM
  2. Delete registry key with wildcard
    By glennda in forum Windows 7
    Replies: 15
    Last Post: 5th February 2013, 03:57 PM
  3. [Pics] One Has To Be On The Lookout For Commoners On One's Land!
    By DaveP in forum Jokes/Interweb Things
    Replies: 0
    Last Post: 9th April 2010, 07:42 PM
  4. VB Delete registry keys with sub keys
    By cookie_monster in forum Scripts
    Replies: 1
    Last Post: 6th November 2009, 08:57 AM
  5. [MS Office - 2007] Error 1406: Setup cannot write the value to the registry key
    By Gatt in forum Office Software
    Replies: 1
    Last Post: 13th September 2008, 03:19 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts