How to Add Custom "Open With .." Command to Windows Context Menu

Tutorial Dec 3, 2020

A simple guide on how to add your own “Open With ..” command to the Windows context menu (the right-click menu).

For the purpose of showing you an example, I will be adding “Open with Sublime Text 3” to the Windows context menu. The default Sublime Text 3 installer does make this task hassle-free during the installation process by giving us the option in the installer wizard. I do this manually because the installer doesn't create an icon for the context menu option, atleast at the time of writing this. And I like icons!

open with sublime text context menu
Default Sublime Text 3 context menu option

By referring the instructions in this guide, you should be able to add an "Open With .." command for any program of your choice on to the Windows context menu.

Ingredients required:

  • Registry Editor

Note: To launch the "Registry Editor", search and launch it from the Windows Start Menu. Or, do Win + R, type in "regedit", and hit enter or click the "OK" button.

File right-clicks and Folders right-clicks have different context menus. You can choose to add our custom "Open With .." command to only one or both.

FOR FILES

First thing is to navigate to HKEY_CLASSES_ROOT\*\shell. Then right-click shell to create a New -> Key named Open With Sublime Text 3.

registry editor add new key

Next, right-click Open With Sublime Text 3 and create a New -> Expandable String Value named icon.

registry editor add new expandable string value

Double-click icon, and set its "Value data" to C:\Program Files\Sublime Text 3\sublime_text.ico (the path to an icon file)

registry editor modify value data

Next, right-click Open With Sublime Text 3 and create a New -> Key named command.

Double-click (Default), which is inside the command key, and set its Value Data to C:\Program Files\Sublime Text 3\sublime_text.exe "%1"

FOR FOLDERS

For folders, the steps are very similar to that of how we did things for files. The only difference being the location where we create the new registry keys. I'll leave the full instructions nevertheless, so things won't get confusing if you're not too familiar with registry things.

First, navigate to HKEY_CLASSES_ROOT\Folder\shell\, Then right-click shell to create a New -> Key named Open With Sublime Text 3.

Right-click Open With Sublime Text 3 and create a New -> Expandable String Value named icon.

Double-click icon, and set its "Value data" to C:\Program Files\Sublime Text 3\sublime_text.ico (the path to an icon file)

Next, right-click Open With Sublime Text 3 and create a New -> Key named command.

Double-click (Default), which is inside the command key, and set its Value Data to C:\Program Files\Sublime Text 3\sublime_text.exe "%1"

That should be all! You can go test it out on files and folders now.

custom open with sublime text 3 context menu option with icon
Final Result

Just like that, we manually added an "Open With .." context menu option. And it has an icon too!

Tags

Lime

Simple, like quantum physics.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.