Adding custom buttons to the Explorer command bar

posted on June 7, 2008 by Andreas

With Vista, Microsoft redesigned Windows Explorer a lot. One of the biggest changes was the removal of the customizable toolbar. Up to Windows XP, adding or removing the buttons that were displayed in Explorer was a simple chore.
With Vista, this customization ability is gone; the toolbar is replaced by a so-called green shaded “commandbar,” and none of it can be customized unless you are willing to take a dive into the registry.

In this post, I will show you a way to add custom buttons — like in the above image — to the commandbar by adding items to the registry. Unfortunately, not all buttons (e.g. New Folder) are possible via this way.

The registry key

We start by opening up regedit as administrator (start, type regedit and hit enter. Accept the UAC prompt if you have UAC enabled). Once inside regedit, we navigate to the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\FolderTypes

Under this key, you’ll see a list of numbers in the format of {de2b70ec-9bf7-4a93-bd3d-243f7881d492}. These numbers are CLSIDs and represent the special folders such as Documents, Music, Drives in Explorer.
Most of the CLSIDs can be figured out by clicking the registry key and looking at the CanonicalName. For example, {de2b70ec-9bf7-4a93-bd3d-243f7881d492} has its CanonicalName set to Directory.Contacts, so it is likely that these CLSID refers to the Contacts folder.

TaskNoItemsSelected

Under some of the CLSID registry keys, you’ll see another key named TaskNoItemsSelected. For example, {de2b70ec-9bf7-4a93-bd3d-243f7881d492} (the Contacts folder) has this subkey. If you further expand this key, you will see that it has numbered subkeys 0, 1, 2 and 3.
These subkeys actually contain a description of the buttons that are added to the commandbar when no item is selected in the Contacts folder.

Editing TaskNoItemsSelected

Before we can edit this registry key, you need to make sure you have the proper rights to do so. On a fresh install, only the installer can write or modify these registry keys.
If you plan on editing some of the button, take ownership of the FolderTypes registry key by right-clicking it and selecting Permissions. Next, click Advanced and go to the Owner tab. In here, you can select your own user or the Administrators group as the new owner. Before hitting OK, tick the bottom-most checkbox saying something along the lines of ‘Replace owner of the underlying objects’.
After doing this, you now have the proper rights to edit the FolderTypes.

We start by adding a new key under the {de2b70ec-9bf7-4a93-bd3d-243f7881d492}\TaskNoItemsSelected key. We name it 4, since 0 to 3 already exists.

The next thing we need to do is add another subkey under the 4 key, which needs to be a unique and long number (called a GUID). For generating GUIDs, we use the following tool: http://www.somacon.com/p113.php . Hit the Generate UUID/GUID button and copy the GUID to the clipboard. We got the {61C0D9CB-BB72-4013-8769-EC628B50C351} GUID from this tool.
Now we got a GUID, we add it under TaskNoItemsSelected\4 as a subkey, so we end up with the key:

\TasksNoItemsSelected\4\{61C0D9CB-BB72-4013-8769-EC628B50C351}

In this key, we add the following values in the right pane:

  • (default), Character string, with a value of MyButton
  • Icon, Expendable Character string, with a value of c:\windows\system32\calc.exe, 0
  • InfoTip, Character string, with a value of My Custom Tooltip
  • Title, Character string, with a value of My Custom Item

When done right, you’ll end up with:

These values let Explorer know how our button should look like. They are self-explanatory, except for Icon, which takes a string in the form of PathToExeOrDllFile, iconNumber. In our example, we tell Explorer to use the first Icon from the Calculator.

We now have told Explorer what our custom button looks like, but not what it should do. We do this by adding a the following subkeys to our custom-button key: shell\InvokeTask\command. In the command key, we change the (Default) value to the application we want to launch when the button is clicked. Let’s put in c:\windows\system32\calc.exe to launch calc.

If you did everything right, you ended up with the following key structure under FolderTypes:

Now, if you go into the Contacts folder, you will see a My Custom Item button, which, when clicked, will launch the Calculator.

Next time we will delve into the TasksItemsSelected list, which has some additional properties!

22 Comments

UK.Intel said on June 8, 2008 at 4:35 am:

Thank you Andreas for this tutorial, now i can access my favorite applications on the fly. Very Useful.

Hiroshi said on June 8, 2008 at 8:15 am:

This seems a bit senseless as you can just add what you want in the Favorite Shortcuts menu on the left hand side of explorer…

Sam Johnson said on June 8, 2008 at 9:35 am:

You could do that Hiroshi but then you have space taken away from the Folders section which is really nice to have.
Great tut Andreas :)

Panda X said on June 8, 2008 at 10:17 am:

Thanks :D I’ve always wanted this :D

happyandyk said on June 8, 2008 at 10:31 am:

A nice and useful tip. Thanks :)

Dannydeman said on June 8, 2008 at 1:58 pm:

Well, AndreasV made a nice app to do this:

http://mpj.tomaatnet.nl/vista/explorerbuttons.html

Hiroshi said on June 8, 2008 at 6:46 pm:

It is a nice tut, and thanks for posting the link Dannydeman. :)

Paradox31102 said on July 4, 2008 at 7:53 pm:

I notice there are some buttons that are always visible such as ‘Organize’ and ‘Views.’ Is there a key that i can add to that will make my new buttons visible in every folder type or do i have to edit the string for each folder type individually?

Jfrm said on August 7, 2008 at 5:51 pm:

Doesn’t work on Vista SP1

Manan said on August 8, 2008 at 12:02 pm:

I was looking a way to edit the reg file and searched, which led me here. Great! Thank you.

BlackTiger said on September 2, 2008 at 6:09 am:

Nice. But how to add “Copy to/Move to” options to toolbar?
Those command don’t have “command line”, only special GUIDs.

I can add then to context menu but not to the toolbar.

idas [zeusosx] said on October 8, 2008 at 3:00 am:

this is fantastic work, giving so much .
——————
Andreas just a question: is it possible for somone like you, to make those commands as shortcuts so to be used from navigation pane, so nomore needed the folderband [command toolbar], please ?

Stefano said on October 19, 2008 at 3:33 pm:

Hi,

thank you for your efforts and possible further instructions for adding other buttons (the ‘delete’ command, for example).
I have, however, one remark and one question to submit.

Remark: I could not find any occurrence of ‘TaskNoItemsSelected’ key, even under ‘{de2b70ec-9bf7-4a93-bd3d-243f7881d492}’ key. In this case, do I have to create it?
Question: where is the so called ‘Contacts folder’?

OJi said on January 19, 2009 at 4:38 am:

Hello,

Can this be used somehow to add cut/copy/paste buttons ?

Thanks,
OJi.

Stealth said on June 11, 2009 at 7:35 am:

Not a very clear tutorial. I want global commands. Like “Copy To”, “Delete”, and “Move To” ETC. Not just limited to a folder. We need more information on how this is done.

Piyush Soni said on July 16, 2009 at 8:23 pm:

Great Tip Andreas!

Just like the calculator, can I somehow send the currently open folder or the selected item path to my application as an argument like %1 or %2. (As we add items to the explorer context menus, and our application gets the selected item’s path). What I want to do is run an application relative to the folder I’m currently in.

Thanks,
Piyush

Nick said on July 23, 2009 at 4:12 am:

I also would like to know how to send the current folder as an argument to the command. Thanks!

-Nick

Nick said on July 23, 2009 at 5:59 am:

For those interested, you can get the current directory by using %2 and the current selected directory using %3.

steve said on October 16, 2009 at 7:49 am:

What is the registry thread for every folder/file? I want to place a button that’ll be available whenever any file/folder selected, not just specific ones, like Contacts/Libraries and so on. Just the usual files/folders.

ammoun said on November 14, 2009 at 7:55 am:

Can anyone please guide me to a “Delete” button add-in or tweak (like the Mavis Up Button) to add to my tool bar in Win 7? Thanks

BarbouK said on December 19, 2009 at 5:55 am:

Thank you very much !

I was looking for this for long ;)

I created a “Run SCons” command to directly compile my projects in one single click. Works like a charm.

nathan323 said on May 4, 2010 at 12:16 am:

Hey, yeh that was great! I am trying to use this new button to shortcut to Context>New>Text Document command, so it creates a new text document unopened ready to be titled, just like the New Folder button. Any ideas how this should be done? Apologies if this is not the place for questions, I’ll post to forum as well :)

Thanks, Nathan

Leave a comment