How to jump to the desired registry key with one click

If you are addicted to various registry tweaks like I am, you probably work with the Registry Editor very often. Various websites related to tweaking instruct you to go to different registry keys. I would like to share my own way to jump to the desired registry key directly and skip manual navigation with the Registry Editor. This can be done with a simple VB script file without using third-party software. Click "Read more" if you are interested.

Overview

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\CurrentVersion\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

Windows 10

If you are running Windows 10 build 14942 or above, you need no scripts of third party apps. Since build 14942, the Registry Editor app in Windows 10 got an address bar, which displays the current Registry key path, and allows you to copy and paste it.

You can use shorthand notation for HKEY_* root key names. They are as follows:

  • HKEY_CURRENT_USER = HKCU
  • HKEY_CLASSES_ROOT = HKCR
  • HKEY_LOCAL_MACHINE = HKLM
  • HKEY_USERS = HKU

So, when you need to go directly to HKEY_CURRENT_USER\Control Panel\Desktop, you can type the following in the address bar:

hcku\control panel\desktop

Once you hit the Enter key, the path will be automatically expanded to HKEY_CURRENT_USER\Control Panel\Desktop. See the following screenshot:

registry-toolbar-1 registry-toolbar-2 registry-toolbar-3

 

Windows 8.1/Windows 7/Windows Vista and Windows XP

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.getdata("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\Applets\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.getdata("text")
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\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

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

RegistryOwnershipEx software

One of my apps, RegistryOwnershipEx, allows you to do the following tasks:

  • you can take ownership of a registry key with one click (useful to get full access to the key).
  • you can jump directly to the desired registry key also with one click.

RegOwnershipEx
It can also read any registry path from the Windows clipboard. If you run it with "/j" command line argument, e.g. regownershipex.exe /j, it will extract the registry key path from the clipboard and open Registry Editor directly.
Personally, I prefer to use RegistryOwnershipEx. Get it here:

RegOwnershipEx

53 thoughts on “How to jump to the desired registry key with one click

  1. Mike

    Don`t work in my Win 7 64-Bit. I have download the Script an select the Text. Then copy with ctrl+c to clipboard.
    Also the i startet the reg.nav.vbs and i become an error. the Message says that is an error in thze vbs-Sript.

    Regard

    Mike

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  2. Sergey Tkachenko Post author

    hehe, thats because I have used wrong comment symbol :)
    Fixed! Thanks for report!

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
  3. moinmoin

    Mmh, will not work for me.
    line: 1
    character:1
    error: command expected
    800A0400
    I hope it’s correct. i become the error message in german.

    greetings
    moinmoin

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  4. moinmoin

    Ahh sorry. it’s fixed. Now it’s work fine.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      No probs. Thank you for report

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  5. Mike

    Very Thmanks for this script. Now also works great.
    Can you make a Chriome Extencion, so users can open Reg-Entries over the Browser ?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  6. Miki

    Or simply use favorites inside regedit?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      Thats handy only if you visit a key early, not the first time.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  7. Ken Mason

    Here’s a Firefox tip: Try using the Remove It Permanently extension.It can be found at: https://addons.mozilla.org/en-US/firefox/addon/remove-it-permanently/?src=userprofile.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  8. shamu726

    This doesn’t seem to work for keys that are only in the 32 bit registry.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  9. ORelio

    Thanks that’s really useful ! :)

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  10. Oz

    This is really great.

    The only slight problem is if the clipboard contains invalid data or no data then there is an error. Maybe it could just open Regedit to the top instead of giving an error. I guess this doesn’t really matter – it’s nice that this is super small and simple and it shouldn’t be made more complex…

    Thanks.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  11. X

    Hi
    Thanks for this little script.
    OTOH you might be interested in this (even easier to use) Firefox extension: Open RegEdit Key, available at http://www.kashiif.com/firefox-extensions/open-regedit-key/.
    Select a registry key on a web page and select ‘Open in regedit’ from the context menu. Registry editor will open with that key being selected. Simple!

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  12. Kishan Bagaria

    Nice. I made this myself some months ago, here’s my version:

    On Error Resume Next
    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    WshShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey”, Replace(createobject(“htmlfile”).parentwindow.clipboarddata.getdata(“text”),”HKCU”,”HKEY_CURRENT_USER”), “REG_SZ”
    WshShell.Run “regedit.exe -m”

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  13. mohd zaffer

    win 8 .1 very good good

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  14. Tobias

    Really, really great work!!!

    In the latest Version (1.0.0.1), with distance, the best registry modifying software.

    Thanks a lot and best regards.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      Thank you

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  15. wschloss

    Tastes great, less filling, good work and THANK YOU.

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
  16. Dennis

    It doesn’t work for me on Windows 10.0 (RTM build 10240)

    Poorly-rated. Like or Dislike: Thumb up 0 Thumb down 8

    Reply
    1. Sergey Tkachenko Post author

      Then you are doing something wrong.
      It works.

      Well-loved. Like or Dislike: Thumb up 6 Thumb down 0

      Reply
  17. regjump

    I’ve personally been using RegJump for a long time and prefer it to this method since it also checks the validity of your clipboard content and doesn’t change any registry keys. Just create a new textfile in the same directory as regjump.exe with the content @regjump -c and save it as something.bat. When you then run that it will automatically jump straight to the registry key you had in your clipboard.

    https://technet.microsoft.com/en-us/sysinternals/bb963880.aspx

    Like or Dislike: Thumb up 1 Thumb down 0

    Reply
    1. Angry Thinker

      There is a Chrome extension that uses RegJump, so all you have to do is select the key in the text you’re reading, right click & click on the regjump option.

      Like or Dislike: Thumb up 1 Thumb down 0

      Reply
      1. Sergey Tkachenko Post author

        Cool.

        Like or Dislike: Thumb up 1 Thumb down 0

        Reply
  18. Mehdi

    100% doesn’t work on Widnwos 10 (10240), nothing happens.

    Like or Dislike: Thumb up 1 Thumb down 1

    Reply
    1. Sergey Tkachenko Post author

      You are 100% wrong. I use this trick daily while developing Winaero Tweaker.

      Like or Dislike: Thumb up 1 Thumb down 1

      Reply
  19. Mehdi

    No one does not waste his time to lie to you.
    two people say it’s not work on windows 10 10240.
    If you think you’re so you’re right.

    Like or Dislike: Thumb up 1 Thumb down 1

    Reply
    1. Sergey Tkachenko Post author

      Ok.
      I am on 10240 pro x64. All methods mentioned in this article work for me.
      I am using my app (ROEX) daily, and just now i checked the VBS script once again.
      Both works.
      Now give me your steps to reproduce: what you did step by step and what failed for you.
      Let’s resolve the issue.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
      1. MDJ

        It‘s true that this program doesn‘t work properly in Windows 10. It‘s working sometimes but for past several days I had to manually go to desired keys as it was displaying a screen I posted below. Perhaps I‘ll try using script instead of the program but it may not go well either.

        Like or Dislike: Thumb up 0 Thumb down 0

        Reply
        1. Sergey Tkachenko Post author

          Please tell me to which key you are trying to jump?
          I will try to reproduce.

          Like or Dislike: Thumb up 0 Thumb down 0

          Reply
          1. MDJ

            It looks like that copying the key to the clipboard before opening your program works most of the time. If I get any bug in the future with specific key I‘ll post it here.

            Like or Dislike: Thumb up 0 Thumb down 0

          2. Sergey Tkachenko Post author

            hmm OK.
            But can you tell me what exactly failed for you then?

            Like or Dislike: Thumb up 0 Thumb down 0

          3. MDJ

            Can‘t find atm, perhaps it started to work.

            Like or Dislike: Thumb up 0 Thumb down 0

          4. MDJ

            Faced this problem again. The key this time is:
            [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]

            Like or Dislike: Thumb up 0 Thumb down 0

          5. Sergey Tkachenko Post author

            Try to remove brackets “[” and “]” from the key path.

            Like or Dislike: Thumb up 0 Thumb down 0

          6. MDJ

            It did work. Perhaps me and others faced that problem only because of those brackets.

            Like or Dislike: Thumb up 0 Thumb down 0

          7. Sergey Tkachenko Post author

            I will implement auto-replacement of those brackets in the next release.

            Like or Dislike: Thumb up 2 Thumb down 0

          8. MDJ

            Great idea!

            Like or Dislike: Thumb up 0 Thumb down 0

          9. Sergey Tkachenko Post author

            Actually, it was suggested by a user :)

            Like or Dislike: Thumb up 2 Thumb down 0

  20. MDJ

    Sometimes in Windows 10 your program stops to work (doesn‘t jump to the key entered and shows “Current owner” as blank. I don‘t know what causes this problem but it may be that Explorer shell restarting. I‘m adding a screenshot also: http://i.imgur.com/3QAQjcn.png

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. MDJ

      Apparently Explorer shell restarting doesn‘t make any difference since I‘ve restarted my PC and the problem persisted.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  21. shamu726

    Why does it not work if key path starts with “HKCU” instead of “HKEY_Current_User”?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      It works in RegistryOwnershipEx only.
      In other cases it does not work.

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  22. ramzah

    I noticed that it doesn’t work if there are spaces before or after the key. Maybe you can implement it to auto-remove spaces?

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  23. Angry Thinker

    Many thanks for this useful little script. Is it possible to have the script open the registry editor bypassing the UAC?
    The UAC is just an annoying prompt for the regedit.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  24. mr

    Update: RegistryOwnershipEx works ok, but the vbscript puts me in a endless “loop” of opening multiple instances of regedit.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  25. Guest

    I improved the VBScript. Now it works with registry-paths beginning with HKLM or HKCU for example.
    Additionally it removes spaces and it removes the backslash at the end of the string in the clipboard, if available.
    I know, this could be implemented easier, but my VB skills aren’t good.

    Dim objHTA
    Dim cClipBoard
    Dim WshShell
    set objHTA=createobject(“htmlfile”)
    cClipBoard=objHTA.parentwindow.clipboarddata.getdata(“text”)
    Do
    If Right(cClipBoard, 1) = ” ” Then cClipBoard = Left(cClipBoard, Len(cClipBoard)-1)
    Loop Until Right(cClipBoard, 1) ” ”
    Do
    If Left(cClipBoard, 1) = ” ” Then cClipBoard = Right(cClipBoard, Len(cClipBoard)-1)
    Loop Until Left(cClipBoard, 1) ” ”
    If Left(cClipBoard, 4) = “HKCR” Then cClipBoard = “HKEY_CLASSES_ROOT” & Mid(cClipBoard, 5)
    If Left(cClipBoard, 4) = “HKCU” Then cClipBoard = “HKEY_CURRENT_USER” & Mid(cClipBoard, 5)
    If Left(cClipBoard, 4) = “HKLM” Then cClipBoard = “HKEY_LOCAL_MACHINE” & Mid(cClipBoard, 5)
    If Left(cClipBoard, 4) = “HKU” Then cClipBoard = “HKEY_USERS” & Mid(cClipBoard, 5)
    If Left(cClipBoard, 4) = “HKCC” Then cClipBoard = “HKEY_CURRENT_CONFIG” & Mid(cClipBoard, 5)
    If Right(cClipBoard, 1) = “\” Then cClipBoard = Left(cClipBoard, Len(cClipBoard)-1)
    Set WshShell = WScript.CreateObject(“WScript.Shell”)
    WshShell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey”, cClipBoard, “REG_SZ”
    WshShell.Run “regedit.exe -m”
    Set objHTA = nothing
    Set WshShell = nothing

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Guest

      Note that the comment removed the inequality-operator in Line 8 Column 33 and Line 11 Column 32.
      Further you have to replace the quotes (“) with new quotes…

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  26. André

    Win 10 with Visual studio 2015

    added:
    Dim WScript As Object = Nothing

    ‘Let’ and ‘Set’ assignment statements are no longer supported.

    for WshShell.RegWrite and WshShell.Run getting:
    Method arguments must be enclosed In parentheses.

    screenshots:
    https://s5.postimg.org/vbmkomgrr/Screenshot_1.png
    https://s5.postimg.org/yjr21o31j/Screenshot_2.png

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
    1. Sergey Tkachenko Post author

      because VB is not VBscript

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
    2. Pete Gomersall

      Sergey,
      I believe the people for who it doesn’t work are doing the test by copying “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon” from your web page. In W10 at least in my tests with Edge if you copy any text with a space from this page an invalid character is copied for the space. Works fine where there are no spaces in the copied text.
      Pete

      Like or Dislike: Thumb up 0 Thumb down 0

      Reply
  27. halserrano

    Both regownershipex and regnav.vbs working fine, but is it possible to make a third party registry editor like O&O RegEditor the default in place of regedit?

    thanks

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  28. Chris

    I simply use ctrl+f (search) and enter the keyname
    It would be nice just to export that particular key so I can save it in my reg tweaks and merge them all at once.

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply
  29. Byron

    on error resume next

    dim html
    set html = CreateObject(“htmlfile”)

    dim clipboard
    clipboard = html.parentwindow.clipboarddata.getdata(“text”)
    clipboard = Replace(clipboard, vbNewLine, “”)
    clipboard = Trim(clipboard)

    if InStr(LCase(clipboard), “hkcr\”) = 1 then clipboard = “HKEY_CLASSES_ROOT” + Mid(clipboard, 5)
    if InStr(LCase(clipboard), “hkcu\”) = 1 then clipboard = “HKEY_CURRENT_USER” + Mid(clipboard, 5)
    if InStr(LCase(clipboard), “hklm\”) = 1 then clipboard = “HKEY_LOCAL_MACHINE” + Mid(clipboard, 5)
    if InStr(LCase(clipboard), “hku\” ) = 1 then clipboard = “HKEY_USERS” + Mid(clipboard, 5)
    if InStr(LCase(clipboard), “hkcc\”) = 1 then clipboard = “HKEY_CURRENT_CONFIG” + Mid(clipboard, 5)

    while Right(clipboard, 1) = “\”
    clipboard = Left(clipboard, Len(clipboard) – 1)
    wend

    ‘ MsgBox “|” & clipboard & “|”

    dim shell
    set shell = WScript.CreateObject(“WScript.Shell”)
    shell.RegWrite “HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey”, clipboard, “REG_SZ”
    shell.Run “regedit.exe -m”

    Like or Dislike: Thumb up 0 Thumb down 0

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *