Sublime Text 3, how to add to right click?

You can click a checkbox labelled Add to explorer context menu when installing Sublime Text.

If that does not work; here is a thread that goes in depth into how to achieve this: https://sublimetext.userecho.com/topics/3947-windows-context-menu-right-click-edit-with-sublime-notepad-style/


Just create a reg file subl.reg and open it with a text editor and add the content:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text]
@="Edit with &Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"
"MuiVerb"="Edit with Sublime Text"

[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text\command]
@="C:\\Program Files\\Sublime Text 3\\sublime_text.exe \"%1\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime]
@="Open with Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%V\""

[HKEY_CLASSES_ROOT\Directory\shell\Sublime]
@="Open with Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text 3\\sublime_text.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\Sublime\command]
@="\"C:\\Program Files\\Sublime Text 3\\sublime_text.exe\" \"%1\""

You may need to adapt the paths to your Sublime Text installation. This will add Sublime Text when you rightlick on a file, rightlick on a folder background, and rightclick on a folder. Just double click on the file to add the entries into your registry.

You can always edit and delete those entry by pressing window+r and then write regedit in that panel. There you will see the same path structure, e.g. HKEY_CLASSES_ROOT\*\shell for right click commands.


  1. Create a new text document with notepad and save it on your desktop
  2. Rename it to OpenWithSublime.bat
  3. Put this inside:

@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
 
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
 
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
pause

rem add it for right click on explorer
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime"         /t REG_SZ /v "Icon" /d "%st3Path%" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Sublime\command" /t REG_SZ /v "" /d "%st3Path% \"%%V\"" /f
pause
  1. Run it as Administrator

Source: https://gist.github.com/roundand/9367852

Tags:

Sublimetext3