How can I add a program to the context menu of all files?

17

6

Similar to the way Notepad++ adds "Edit with Notepad++" to the context menu of all files, or how most Antivirus products will add a global "Scan this file" option, I would like to add a particular program to the context menu for all file types.

Thanks to DOSBox, I'm a little familiar with manually creating file associations and creating context menu options for specific file types.

http://www.dosbox.com/wiki/Associating_the_Configuration_File_in_Windows

However, I've got one program I'd like to add as a context menu globally because it can be used with files that have almost any extension. What registry keys do I need to modify for this, and what common pitfalls should I avoid in order to not break things here?

I'd rather do this manually, so that I'm intimately familiar with what changes I'm making to the system, rather than use a third-party tool. The OS I'm doing this on is Windows 7 x64, but it would be great if the same method could be used all the way back to XP. I can probably figure out the necessary command syntax myself - I just need to know which keys to go after and how to format the commands and labels to be properly recognized in those keys.

Iszi

Posted 2012-02-21T04:01:21.357

Reputation: 11 686

Answers

18

Here is how you do it with an executable, I would assume it could be done with any program.

Open regedit.exe through the start menu search or run box, and then browse down to the following key:

HKEY_CLASSES_ROOT\ *\shell

Right-click on “shell” and choose to create a new key, calling it “Open with (your program name)”. Create a new key below that one called “command”. Double-click on the (Default) value in the right-hand pane and enter in the following:

"C:\Folder path where the program resides\Program.exe" "%1"

The change should take effect immediately… just right-click on any file and you’ll see the next menu entry.

.
Screenshots:

. Registry Editor: Creating a key

.

Registry Editor: Finished file-command

Source of Information (sort of)

. [Note: Article-comments report author's method works for Vista; and also XP. - Ed.]

Moab

Posted 2012-02-21T04:01:21.357

Reputation: 54 203

Why am I not surprised to see a HTG article about this? Thanks for pointing me to it. What about the other part of my question - any common pitfalls to avoid, in terms of syntax or other things that could break this? – Iszi – 2012-02-21T04:27:48.530

You assume I am smart enough to answer that, thanks. Its a pretty simple and strait forward reg hack, i don't forsee any problems. – Moab – 2012-02-21T04:39:25.613

One thing I am not sure of, if your program executable needs to reside in the system32 folder or not, maybe someone else knows. You might have to change the default data to reflect the file path to your program exe installed, instead of %1. C:\Program Files\My Program\program.exe, someone else needs to chime in here. – Moab – 2012-02-21T04:41:40.447

I'm going on the assumption that it can be wherever you want, as long as you specify the full path (I'll let you know if that doesn't work). For bonus points (and I'll add this to the question): How do I give the action its own icon? – Iszi – 2012-02-21T04:42:50.120

I changed my post to include the proper synatax for the program path. Not sure where it pulls the icon from. – Moab – 2012-02-21T04:50:01.123

1Indeed, the path does not matter as long as the user has access to it. – iglvzx – 2012-02-21T04:52:26.073

Tested: As long as you include the full path, in quotes (if there's spaces), you can put the program wherever you want. The separate quotes around %1 are also important. I'll go ahead and ask about the icon separately. – Iszi – 2012-02-21T04:58:36.183

3

You can also try with this little freeware program:

http://defaultprogramseditor.com/

It just sorted out all the mess for me with .js files. Before that I tried several different ways of adding default handler programs. Highly recommended.

Note that I've got nothing with the developer/publisher of the software. Just a happy new user.

Edit: Oh, just found it's been recommended already: Why can't change the default program to open an extension in Windows 7?

Alen Siljak

Posted 2012-02-21T04:01:21.357

Reputation: 130

1

There are lots of freeware to do it. My favorite is ContextEdit (freeware, no ads). Other programs can be found at: http://www.thewindowsclub.com/remove-click-context-menu-items-editors

Dio Phung

Posted 2012-02-21T04:01:21.357

Reputation: 739