How to Sort the Registry Editor Favorites Menu?

The Favorites menu in the Registry Editor (Regedit.exe) is very useful especially if you’re someone who loves playing with the Registry Editor all the time. If you’ve noticed, the favorites menu in Regedit doesn’t have an option to sort the entries alphabetically. If you have many entries in the favorites menu, finding an item from the unsorted listing is a minor inconvenience.

Registry Editor favorites are displayed in chronological order, although the date and time stamp meta data aren’t shown in the user interface. If you export a key to a text file (instead of .reg format), the date/time stamp in shown in that text file, and that too the Last Write Time is shown only at the "key" level, and not for the individual "values". And in Regedit, there is no "Sort by Name" option, which is available in Internet Explorer Favorites menu. The Regedit favorites are stored in this registry path:

HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites

To sort the Registry Editor Favorites alphabetically, you can use one of the following methods.

Export to a REG file and Sort the Values Manually

In Regedit.exe, export the above key to a .REG file, and then delete the Favorites branch. In the exported REG file, the values are listed exactly as shown in the Favorites menu – so you need to sort it manually. Edit the REG file using Notepad and sort the values manually, save the file and double-click the file to run it. This rewrites the values, but this time adds entries in alphabetical order.

Export to a REG file and Use Sort command in Command Prompt

After exporting the above key to a .REG file, say D:\unsorted.reg, open a Command Prompt window and type:

SORT D:\UNSORTED.REG /O D:\SORTED.REG

This sorts the REG file contents, including the Windows Registry Editor Version 5.00 and the branch name. After sorting, open the Sorted.reg file using Notepad, and move the following header information to the top of the file.

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites]

Also, add the following line in the middle, which clears the existing Favorites branch in the Registry Editor. This is important.

[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites]

So these three lines are at the top most in the sorted.reg file:

Windows Registry Editor Version 5.00
[-HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites]
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites]

Save the file unsorted.reg, and double-click to run it. This sorts the Regedit Favorites menu.

Using RegScanner to get the sorted listings in a .REG file

RegScanner from Nirsoft is a nice utility that lets you find registry data with specified search criteria, and display them in one list. The list can be exported to a .REG file.

In RegScanner’s Scan Options page, type regedit\favorites in Find String, and set it to scan only the HKEY_CURRENT_USER hive. When the scan results are shown, sort the results by Name column in reverse alphabetical order. From the File menu, click Export and save to a REG file.

(For some reason, if the listing is in alphabetical order, RegScanner v 2.1.5.0 exports the values in reverse alphabetical order in the REG file, and vice-versa.)

You get the alpha-sorted list.

Important: Before running the REG file, the existing Favorites branch in the Registry Editor has to be deleted.

(Unsorted vs. Sorted Favorites menu)

You may script this task (which should be pretty easy) if you want to do the alpha-sort in a single mouse click.

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.