Windows

Use special codes to add commands to the Windows Explorer Command Bar

Greg Shultz reveals hidden codes in the Windows 7 Registry that will allow you to add commands to Windows Explorer's context sensitive Command Bar.
I like having the Show the Preview pane button on the Command Bar in Windows Explorer, but when I use it, I want to hide the Navigation Pane and the Details Pane to give me more room for the preview, as shown in Figure A. However, to get there, I have to go to the Organize menu, access the Layout menu, and select the Details Pane toggle, and then I have to go back through all that again to select the Details Pane toggle. It is a real pain (pun intended). I have always wished that Microsoft had put buttons or commands on the Command Bar for those two options, just like they did for the Preview Pane button.

Figure A

When I use the Preview Pane, I like to hide the Navigation Pane and the Details Pane to give me more room for the preview.
This blog post is also available in PDF format in a TechRepublic download.

At the very least, I wish that they would have left the ability to customize the Command Bar like they did back in Windows XP. However, in Windows 7 and Vista before it, Microsoft's developers removed the ability to customize Windows Explorer's Command Bar. Instead, they decided to make the Command Bar in Windows Explorer context sensitive. In other words, the commands that appear on the Command Bar depend on the type of folder or file that you have selected using Windows Explorer.

Now don't get me wrong, I have really grown to like the context-sensitive Command Bar, but every once in a while, I long for the ability to customize the Command Bar.

Discovery

Recently, I discovered a set of keys in the Registry, one for each type of Library, that are designed to configure the context-sensitive Command Bars that appear in Windows Explorer. I also discovered a key in the Registry called CommandStore that contains the codes that are the source of the commands that appear on Windows Explorer's context-sensitive Command Bar.

As I explored more deeply, I also found that the key contains codes for commands that don't appear on Windows Explorer's context-sensitive Command Bar. Among those, I found codes for putting the Navigation Pane toggle and the Details Pane toggle on the Command Bar. I also found that I could put the Menu Bar toggle, as well as the Delete command, on the Command Bar.

In this edition of the Windows Desktop Report, I'll show you where the codes exist in the Registry and then show you how to add those commands to Windows Explorer's context-sensitive Command Bar with a simple edit.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

Caveats

Before I get started it is important that you understand the way the Registry is set up for Windows 7's context-sensitive Command Bar. There are different keys in the Registry for different Library folders. For example, there is a key for the Documents Library's context-sensitive Command Bar, a key for the Music Library's context-sensitive Command Bar, and so on. There is also a key (called Generic) for all the other folders that do not appear in any of the Libraries.

This means that if you add only the codes to the Documents Library key, the commands will appear only in Windows Explorer when you are in the Documents Library. If you want the commands to appear everywhere, you will have to add the codes to multiple keys in the Registry.

The keys

Since there are multiple keys that you could potentially be working with, I'll start with a list of the keys.

To begin with, all the keys are located on the following path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\

Here is the list of codes:

Documents Library

{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}

Music Library

{3f2a72a7-99fa-4ddb-a5a8-c604edf61d6b}

Pictures Library

{0b2baaeb-0042-4dca-aa4d-3ee8648d03e5}

Videos Library

{631958a6-ad0f-4035-a745-28ac066dc6ed}

Generic

{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}

Editing the Registry

It is important to keep in mind that the Windows Registry file is vital to the operating system and changing it can be dangerous if you inadvertently make a mistake. As such, you should take a few moments to back up your system by creating a system image in the Backup and Restore tool. That way if anything goes awry, you can restore your system and get right back to work.

To launch the Registry Editor, click the Start button, type Regedit in the Start Menu's Search box, and press [Enter]. When the UAC dialog box appears, respond appropriately.

Taking a look at the CommandStore

As I mentioned earlier, the CommandStore key in the Registry contains the codes that are the source of the commands that appear on Windows Explorer's context-sensitive Command Bar. As I explored more deeply, I also found that the key contains codes for commands that don't appear on Windows Explorer's context-sensitive Command Bar.

Keep in mind that there are more commands than you will want to place on the Command Bar at one time -- there just isn't enough room to display them all. In fact, the commands will appear on a drop-down menu on the Command Bar if there are more than can display at one time. Therefore, you'll want to choose your commands sparingly.

For my purposes, I chose the codes for putting the Navigation Pane toggle, Details Pane toggle, Menu Bar toggle, and the Delete command on the Command Bar.

From within the Registry Editor, navigate to the following folder

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell

When you select shell, you'll see all the codes that you can use to customize Windows Explorer's context-sensitive Command Bar, as shown in Figure B.

Figure B

The CommandStore key in the Registry contains the codes that are the source of the commands that appear on Windows Explorer's context-sensitive Command Bar.

While each of these keys contains subkeys and other details, you need be concerned only with the names in the shell key. For example, to add the Delete command, all you need to know is the code Windows.delete. For my example, I'll use the following codes:

  • Windows.delete
  • Windows.navpane
  • Windows.previewpane
  • Windows.menubar

Customizing the Documents Library

To add the commands to the Documents Library's context-sensitive Command Bar, from within the Registry Editor, navigate to the following folder

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}

When you open the {fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9} key, you'll see three keys below it, as shown in Figure C. The TasksItemsSelected key contains the commands that appear on the Command Bar when an item is selected in Windows Explorer and the TasksNoItemsSelected key contains the commands that appear on the Command Bar when no item is selected. For this technique, the TopView key is irrelevant, so you can ignore it.

Figure C

We'll use the TasksItemsSelected key and the TasksNoItemsSelected key.

Now, analyzing my list of codes, you can see that only the Windows.delete code requires an item to be selected, so it will be added to the TasksItemsSelected key. The Windows.navpane, Windows.previewpane, and Windows.menubar codes do not require an item be selected, so they will go in the TasksNoItemsSelected key.

As you can see, the TasksItemsSelected key contains only the String Value titled Default, which is where we'll put the Windows.delete code. To do so, double click the Default icon to access the Edit String dialog box. Then type a semicolon (;) and the Windows.delete code at the very end of the text box, as shown in Figure D.

Figure D

Make sure you use a semicolon to separate the Windows.delete code from the existing set of codes.

(While you may be tempted to delete codes for commands that you don't use, I would recommend against it. I don't exactly know for sure if doing so would be disastrous, because I haven't tried it.)

Now, access the TasksNoItemsSelected key, double-click the Default icon, and add the Windows.navpane, Windows.previewpane, and Windows.menubar codes at the very beginning of the text box, as shown in Figure E. Be sure to use semicolons to separate each command.

Figure E

Be sure to use semicolons to separate each command.
Now, when you close the Registry Editor and launch Windows Explorer, you'll see the new command on the Command Bar in Windows Explorer when you access any folder within the Documents Library. As you can see in Figure F, when you access a folder and do not select an item, the Navagation Pane, Details Pane, and Menu bar commands are available. When you select an item, the Delete command is available.

Figure F

New commands are now available on the Command Bar.

Other locations

If you want to add commands to the Windows Explorer Command Bars for Music, Pictures, or Videos, you'll have to repeat these steps in each of the appropriate Registry keys I discussed earlier.

To add commands to the Windows Explorer Command Bars for all the other folders that do not appear in any of the Libraries, you'll have to do a bit more work with the Generic key in the Registry. In short, you'll have to change the ownership and permissions on the key and then add the TasksItemsSelected and the TasksNoItemsSelected keys manually, before you can add the codes.

I'll go into more specific details on how to do so in next week's blog post.

What's your take?

Have you wanted to be able to customize the Command bar in Windows 7's Windows Explorer? Will you employ this technique to customize the Command bar? As always, if you have comments or information to share about this topic, please take a moment to drop by the TechRepublic Community Forums and let us hear from you.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

9 comments
Cal Wilson
Cal Wilson

The tweak seems to only work if you are using libraries. I applied the tweak to make the navigation pane command appear. I opened Windows Eplorer. I did not select a library, simply opened a folder. The command does not appear. Is there a way to make the navigation pane command appear on the Command bar when libraries aren't used? Thanks in advance.

luismatoso
luismatoso

Thank you very, very much. This was something i was looking for a long time. i can wait to read your next article. Thank's again for this tips. Best regards

mike.laing
mike.laing

When I open the generic key, there are only 2 keys: Modifiers and TopViews. Can I add the keys TaskItemsSelected and TaskNoItemsSelected and then the REG_SZ (String Value, I assume) Default? Then add the Value Data Windows.whatever? (If I try it, I guess I better export the whole key so I can restore it if something screws up!)

jjmcgaffey
jjmcgaffey

So every time I select something, three items will disappear and one will appear? I think it would drive me nuts.

don
don

Since I turned libraries off, this doesn't help much. If I could just turn them off when exploring my drive. I use the old style FILE | EDIT | VIEW menus Also, maybe off topic, but found the preview pane will open and lock a file, so if you browse to it with preview on, then go to edit the document... you can't, even closing the explorer does not allow you to edit, it takes a reboot to unlock the file.... drove me crazy one night helping out one of our engineers. AND if this goes through... Why has Techrepublic gone anti Firefox? Kept getting permission denied.

kaspencer
kaspencer

This was interesting. But has anyone done any work on taking Windows Vista and Windows 7 back to the behaviour of Windows XP, at least so far as the XP right-click popup menus are concerned? I am referring to the fact that there are many occasions when we must separate the "Open" action into rather more specific actions. For example, if I write a command line script, "Open" is not appropiate. I want "Run" to execute it, and "Edit" to enable me to edit it. And I might be very fussy about how I might deal with web pages: I might prefer to choose a specific set of editors for various procedures. With Windows XP I could create new actions and name them, for example, "Wordpad", "Expression Web", "Visual WebDev", each explicitly named in the popup menu and the appropriate program assigned to the action. I have fiddeled about a bit with creating new actions in Vista/7 but wondered whether anyone had any systematic ideas. Regards Kenneth Spencer

happykinds
happykinds

Wonderful article, but you left me hungry. I look forward to hear from you next week. Thanks. Fausto

Mark W. Kaelin
Mark W. Kaelin

What do you think of Greg's Windows Registry tweak? Have you been looking for a way to customize Windows Explorer?

CisfRjsii
CisfRjsii

I have - But I`m so Busy with ALL the Varients of Windows ,, It`s Quite hard to follow Just one and keep abreast .. personally I love to Regedit my own Context menues .. Ziggy.42o ?????

Editor's Picks