This is probably one of those ‘been around forever and I just never noticed it’ features in REGEDIT.
Disclaimer: Use Registry Editor at your own risk. If you use Registry Editor incorrectly, you can cause serious problems that may require you to reinstall your operating system. This information is provided on an “as is” basis and all risk is with you. Improper use of Regedit can also make you sterile. NoGeekLeftBehind makes no warranties, express, implied or statutory, as to any matter whatsoever, and does not guarantee that problems that you cause by using Registry Editor incorrectly can be resolved.
In REGEDIT the location of the current registry key is displayed at the bottom of the status bar, like this:
Professional IT folks know the job isn’t over until the documentation is done. When documenting work performed in a service ticket I usually include detailed information about any registry settings that were changed. This means typing all of that location text at the bottom of the screen.
Well, it would seem I’ve been doing it the hard way all of these years.
SOLUTION
Just right-click the registry key name (in the navigation pane on the left), then left-click the Copy Key Name option.
Now the complete REGEDIT location is saved to your clipboard.
Example:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Security\Trusted Locations
Note: You’ll still have to document the DWORD or string values manually, but at least the Copy Key Name function saves a ton of typing.
Alternately, you can left-click the key name, then click on Edit | Copy Key Name from the top drop-down menu.
BONUS INFO
Now, you’re probably saying to yourself, “Duh, I already knew that! What I really need is a cool way to copy and paste a key path to avoid drilling down.”
Well, check out this nifty Windows Registry navigation trick by using the REGEDIT feature called Favorites (to which you probably never paid any attention).
To create a new REGEDIT favorite:
- Click the Key Name in the navigation bar on the left
- Click Favorites on the top drop-down menu
- Click Add to Favorites
- Type the name of the Favorite
- Click OK
You should now see a new favorite listed, like this:
No matter where you are in the registry, clicking the Favorite will jump you to that location in the registry.
Interestingly, those Favorites / shortcuts are kept inside the registry itself,
(we’ll call it Rebel Base) here…
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites
…in a REG_SZ string value like this:
If you want to jump to a location in the registry you can just create a new String in Rebel Base.
For the sake of completeness we’ll show 4 options for registry favorites and changes
-
Option 1 – Manually Create a Registry Favorite
-
Option 2 – Manually Create a New String
-
Option 3 – Create a Registry Favorite by using REG ADD
-
Option 4 – Create a Registry Favorite by using PowerShell
OPTION 1 – Manually Create a Registry Favorite (easy)
If you know you’ll come back to a particular Registry location often:
- Navigate to the Registry location you want to save
- Left-click the Key*
- Click Favorites
- Click Add to Favorites
- Name the Favorite
- Click OK
*The first Favorite I would recommend creating is for Rebel Base, located here:
HKEY_CURRENT_USER
Software
Microsoft
Windows
CurrentVersion
Applets
Regedit
FavoritesIf you perform Option 2 you’ll want to have that Favorite already saved.
OPTION 2 – Manually Create a New String
- a) Navigate to Rebel Base (if you already created it), or
b) In REGEDIT navigate to HKCU | Software | Microsoft | Windows | CurrentVersion | Applets | Regedit | Favorites
- Right-click a blank space in the details pane | New | String Value
- Type the name of the new shortcut | hit Enter
- Double-click the new string | paste the full registry path into the Value Data field | click OK
Example – the location to enable / disable hiding file extensions:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced - You should now see your new Favorite in the drop-down menu.
Once you create the Rebel Base shortcut, from that point on you can easily copy and paste a Registry path into a new Favorite and jump to it.
OPTION 3 – Create a Registry Favorite by using REG ADD
If you know the path and the registry value you want to change, you can use the REG ADD command from the command line.
Alternately, you can save the command into a text file and save it with the .REG file extension.
For more information on the REG ADD command, visit TechNet:
http://technet.microsoft.com/en-us/library/cc742162.aspx
To create a Registry Favorite by using REG ADD:
- Open an Administrative Command Prompt
- Type REG ADD (include a space after each step)
- <Key Name> Paste the location (Key Name) for Rebel Base
- <Value Name> Type /v followed by the name for the new Favorite
example: /v ViaCommandPrompt - <Type> Type /t followed by REG_SZ
example /t REG_SZ - <Data> Type /d followed by the path (Key Name) of the new favorite
If you performed the steps correctly you should refresh REGEDIT and see your new shortcut.
OPTION 4 – Create a Registry Favorite by using PowerShell
To add a new Favorite by using PowerShell, we use the New-ItemProperty cmdlet and specify the following parameters:
- New-ItemProperty
- -Path (the Key Name (location) for Rebel Base)
- -Name (the name you want to give the favorite)
- -PropertyType String
- -Value (the Key Name (location) for the target shortcut)
Note: The following example uses the single back tick to make reading easier
Example:
Note: You may notice that the -Path contains HKCU: instead of HKEY_Current_User. The HKCU: command is just a shortcut.
However, DO NOT use the “HKCU:” shortcut in the -Value line.
Also, double-quotes are important if your -Value includes a space in the Key Name.
Here’s what the PowerShell looks like when it runs in ISE.
And if we refresh REGEDIT we’ll now see our new Favorite.
SUMMARY
Favorites are a quick way to jump around in the Windows Registry. There’s always more than one way to skin a cat, and today we looked at four ways to create a Registry Favorite.
I would recommend creating a PowerShell .PS1 file that sets up Rebel Base for you. Then you can add more shortcuts easily on the fly.
I hope this information helps!