Extended verbs in shell context menus

by Matt 27. October 2006 10:05

 A little while back, Tim Sneath posted a rather nice Vista tip.

Here's a trick that I don't think many people are aware of. Right-click on any folder on your Windows Vista machine while holding down the shift key. You'll see an extra context-sensitive menu item there: Open Command Prompt here. Just click on this menu and a command window will open with the current working directory set to the folder's actual location.

Now, this is a really nice thing. I've always installed the "command prompt here" power toy - now I don't have to. It's even better than the old version, too. It can automatically map a drive letter when you're browsing a UNC path, and it's available when right clicking on the background of a folder view, so you don't have to have the folder tree view visible.

And that's where you spot the bug. At least on my RC2 (5744) build, when you shift-right-click the folders in the folder tree view, it doesn't show up. This made me to wonder if it was a folder view thing. In other words, it wasn't a shell extension defined in the registry, but was a feature of the context menu in the folder view, something the tree view didn't have access to.

Fire up regedit (yes, UAC, I really meant to) and navigate to HKCR\Directory. There's a "cmd" key under both Background\shell and just shell. These both have a "command" key that specifies the cmd.exe command line to run. So, it's not a folder view thing, but a bug in the tree view. Fair enough.

The interesting part is in the "cmd" key. There's a value called "Extended". Knowing my shell extension terminology, there's a flag that gets passed through to a context menu extension called CMF_EXTENDEDVERBS. This tells the context menu to display an extended list of items - items that would normally be hidden. It's usually passed when you hold down shift. Looks like you can also specify it in the registry, too.

And this isn't just a Vista thing, either. It all works under XP, too. Handy thing to know.

Source: Tim Sneath : Windows Vista Secret #1: Open Command Prompt Here


Vista | Shell Extensions | Context Menu Handlers


Month List


Comment RSS