Archive for the ‘Windows tips’ Category

Add custom commands to Explorer’s context menu

October 13, 2007

Just a nifty little tip I picked up today.

Modified Explorer context window

I’ve added links to commands to open up a Command prompt, or Metapath, a nifty little file browser that I use as like a “solution explorer” when, say, editing lots of HTML, PHP or CSS files (from Florian Balmer, the creator of my favourite “lite” text editor, Notepad2).

So, how do you do it? Simple(ish). Open up regedit* and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell. Create a new key (doesn’t matter, AFAIK, what you call it), and set the (Default) property to whatever text you want to appear in the context menu. Next, create a key under that, called “command”. Set the (Default) property of the command you want to run when that is selected.

So to open up the command prompt:

cmd.exe /k pushd %L

And for Metapath (this is assuming you’ve just dumped it straight into C:, you can modify this as appropriate):

c:\metapath.exe "%1"

Editing the registry

Of course, you could just use the “Open Command Window Here” PowerToy – but this is geekier. And more general 🙂

Please note that this all assumes you’re running Windows XP. I have not, and do not intend to, test it for other versions of Windows.

While we’re at it, Oren explains how to replace Notepad with Notepad2 under Windows XP SP2.

* To start regedit, go to the Start Menu and select “Run”. Type “regedit” when the Run dialog comes up. Be careful with regedit. You can do some serious damage to your environment with regedit, so you may want to back up the registry first.

Update, 25/11/07. Added link to Notepad2 replacement procedure. Also, worked around WordPress’ annoying tendency to replace quotes with fancy-looking but useless Unicode characters (presumably, they do this in order to serve you better). It’s rubbish like that that makes me want to write my own blog engine and be done with it.