Add Commands to Windows Explorer Context Menu

From Edgar BV Wiki
Revision as of 13:24, 12 June 2007 by 192.168.0.20 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Here's a quick and easy way to add a couple of custom commands to the Windows Explorer context menu. The first allows you to open any file anywhere using the editor of your choice, such as Notepad2 - an excellent replacement for Windows Notepad.

1. Open the Windows Registry editor.

2. Open the key HKEY_CLASSES_ROOT\*

3. Create a sub-key named shell

4. Create a sub-key beneath that named Open with Notepad

5. Create a sub-key beneath that named command

6. Change the default value to notepad "%1"

Include double-quotes around the %1 parameter, otherwise the command processor attempts to invoke the file that you've right-clicked rather than just passing it to notepad.

This is very convenient. You don't have to add Notepad to the Send to list or sift through the Open with command for unrecognized file types.

I also use the VS command prompt a lot to run msbuild. Here's how to add a command to the context menu displayed when you right-click on a folder to open a VS command prompt with the working directory set to the selected folder.

1. Open the Windows Registry editor.

2. Open the key HKEY_CLASSES_ROOT\Folder\shell

3. Create a sub-key named VS Command Prompt

4. Create a sub-key beneath that named command

5. Change the default value to

cmd /k ""C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat"" x86

Yes, that should be two doule-quotes at either end of the vcvarsall.bat path.

And yet another command I use often, since I do offline version-controlled development and need to unset the read-only bit on files is a command I've named Make Writeable. The value of the command sub-key should be: attrib -r %1. This works even when multiple files are selected.

Using this bit of information, you should have no problem adding your own commands to the Windows Explorer context menu.