Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I think the title says all I want: I want to add context menu items for a specific file type like the yellow marked ones in the screenshot. Which registry changes do I have to make? In my case I want to assign ir.exe to .rb files.

enter image description here

share|improve this question
    
There is a great answer on Stackoverflow: stackoverflow.com/questions/2123762/… –  c0dev Apr 4 at 13:25
    
Thank you :) If you can post this as an answer, I can mark it as the right answer. –  Cubinator73 Apr 4 at 13:38

1 Answer 1

up vote 2 down vote accepted

There is a great answer on Stackoverflow:

1) Identify the file type (ProgID) for .jpg files

This can be done by checking the default value of HKEY_CLASSES_ROOT\.jpg. It could be anything based on what you've installed, but for the purposes of this example, we'll call it jpegfile, a common default.

2) Set the context menu item (verb) properties for that file type

You can set per-user context menu items in HKEY_CURRENT_USER\Software\Classes\jpegfile\shell. This key has a list of verbs for the file type. There is a similar key in HKEY_LOCAL_MACHINE\Software\Classes\jpegfile\shell, and these are the system defaults for the file type. You can put a verb key there too, but if the same key exists in HKCU, it will be overridden, so be advised.

3) Set the command value

The bare minimum key value that needs to be set to get it to work is the default value of the command subkey. You need to set that with the path to your application, like so: HKEY_CURRENT_USER\Software\Classes\jpegfile\shell\open_with_myapp\command would be set to "c:\path\to\myapp.exe" "%1". Now a context menu for .jpg files will have a "open_with_myapp" item which will launch your app when clicked, and pass the file name of the selected file as a parameter. Of course, how your application processes parameters is up to you, so you'd need to set the parameter string to something your app can process.

4) Set other verb properties

I'd imagine you're probably going to want the context menu item to read something a little more friendly than the key name. You can have the context menu display whatever label you want for your item by setting the default value of that key (open_with_myapp).

That's your basic overview. Definitely check out my answer to this question about associating a file, which has a similar answer:

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.