Adding "open with ..." for your favourite program, to Windows context menu

If you choose to download the portable zip version of a program, for example Sublime Text 2, then you might be missing out on the neat feature of having it added to the right-click context menu in Windows.

When you select a bunch of files, and want them opened with your favourite program, theres no context menu item that says “Open in program name”, such as illustrated in this picture:

context-menu

This can be added through editing the registry.

  1. (take a backup of your registry)
  2. Open the registry editor (run -> regedit.exe)
  3. Open HKEY_CLASSES_ROOT\*\shell
  4. Right click on the shell folder, and select New -> Key
    Give the key the name you would like in the context menu, for example “Open with Sublime Text “
  5. Right click on the newly created key (“Open with Sublime Text”), and select New -> Key to create a sub-key. Call this sub-key “command”
  6. Double click the (Default) string inside the newly created “command” folder, and enter the path to your program, in this case, Sublime text 2: C:\dev\SublimeText2.0\sublime_text.exe "%1" Make sure you also enter "%1", including the quotes.
    (Omitting the quotes would mess this up, as it would send the wrong parameters to the program, and open wrong files)
  7. If you now right-click a file, you should see the “Open with your program” option in the context menu.

regedit

You can also add an icon for your context menu item:

  1. Right click on the “Open with Sublime text” folder in regedit, and select New -> String
  2. Call it “Icon” and enter the path to your icon resource, or .ico file:
    "C:\\dev\\SublimeText2.0\\favicon.ico"
  3. Right-click a file, and see if your icon is showing!

You could also save the text below as a .reg file, and run it.

Windows Registry Editor Version 5.00  
[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2]
"Icon"="\"C:\\\\dev\\\\SublimeText2.0\\\\favicon.ico\""
[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command]
@="C:\\dev\\SublimeText2.0\\sublime_text.exe \"%1\""
comments powered by Disqus