I did this recently, although I used a different action than the default Open action.
First you find out the file type of some extension, say .jpg:
var imgKey = Registry.ClassesRoot.OpenSubKey(".jpg") var imgType = key.GetValue("");
Then you will find out the path to the executable file and build the "command line":
String myExecutable = Assembly.GetEntryAssembly().Location; String command = "\"" + myExecutable + "\"" + " \"%1\"";
And register your executable file to open files of this type:
String keyName = imgType + @"\shell\Open\command"; using (var key = Registry.ClassesRoot.CreateSubKey(keyName)) { key.SetValue("", command); }
source share