id="info"

Microsoft

Modify Windows Explorer Command Bar for all folders

Greg Shultz shows you how to modify the Generic registry key to add commands to the Windows Explorer's Command Bar for all the other folders.

In last week's blog, "Use Special Codes to Add Commands to the Windows Explorer Command Bar," I told you about special codes that exist in the registry that you can use to add commands to Microsoft Windows Explorer's context-sensitive Command Bar and showed you where to find them. I then demonstrated how to add those special codes to a set of keys in the Registry for the different Library folders.

I also told you there is a key in the registry called Generic for all the other folders that do not appear in any of the Libraries. I then explained that 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. 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.

In this edition of the Windows Desktop Report, I'll show you how to modify the Generic registry key to add commands to the Windows Explorer's Command Bar for all the other folders.

This blog post is also available in PDF format in a TechRepublic download and as a TechRepublic Photo Gallery.

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.

The Command Store

Don't forget that 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. 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. Keep in mind that 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.

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!

Changing the permissions

Once the Registry Editor appears, navigate to the following folder

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}

When you do, you'll see that while the key is technically named {5c4f28b5-f869-4e84-8e60-f11db97c5cc7}, its CanonicalName is Generic (Figure A), which I'll use from here on out to refer to it. You'll also notice that the Generic key does not contain the TasksItemsSelected and the TasksNoItemsSelected keys by default. As I said, you will have to add them manually.

Figure A

The CanonicalName is Generic.
However, before you can do so, you will have to change the permissions of the Generic key. To begin, right-click on the Generic key and select the Permissions command. When you see the Permissions For dialog box, as shown in Figure B, immediately select the Advanced button to bring up the Advance Security Settings dialog box.

Figure B

When you see the Permissions For dialog box, select the Advanced button.
Now, select the Owner tab, choose Administrators from the Current Owner To panel, and click Apply. Once the Current owner is set to Administrators, as shown in Figure C, click OK to continue.

Figure C

You will need to change owner to the Administrators group.
When you return to the Permissions dialog box, choose Administrators in the Group or User Names panel and then select the Full Control check box in the Permissions panel, as shown in Figure D. Click OK to continue.

Figure D

You must set the Permissions for Administrators to Full Control so that you can make changes to the Generic key.

Editing the Generic key

Now that you have full control of the Generic key, you are ready to begin editing. To get started, right-click {5c4f28b5-f869-4e84-8e60-f11db97c5cc7} and select the New | Key command. When the new key appears, name it TasksItemsSelected. Then, choose the New | Key command again and create the TasksNoItemsSelected key. At this point, your Generic key should look like the one shown in Figure E.

Figure E

Once you finish this step, you should see both the TasksItemsSelected and the TasksNoItemsSelected keys inside the Generic key.

At this point, I'll reuse the list of codes that I chose for last week's article:

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

Since the Windows.delete code requires an item to be selected, it will be added to the TasksItemsSelected key. The Windows.navpane, Windows.previewpane, and Windows.menubar codes do not require an item to 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. Double-click the Default icon to access the Edit String dialog box. Then type the Windows.delete code in the text box, as shown in Figure F.

Figure F

Just type the Windows.delete code in the text box.
Now, access the TasksNoItemsSelected key, double-click the Default icon, and add the Windows.navpane, Windows.previewpane, and Windows.menubar codes in the text box, as shown in Figure G. Be sure to use semicolons to separate each command.

Figure G

Be sure to use semicolons to separate each command.
At this point, close the Registry Editor and launch Windows Explorer. When you do, you'll see the new commands on the Command Bar in Windows Explorer when you access any folder, as shown in Figure H.

Figure H

Your new commands now appear on the Command Bar in Windows Explorer for folders that do not appear in any of the Libraries.

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.

Editor's Picks