Add Sublime Text to Windows 10 context menu

This batch script will add the option to open any file or folder with Sublime Text 3 to the context menu in Windows Explorer.

Alternative 1: Batch file

Just replace the path C:\Portable\sublimetext\sublime_text.exe with the path to your sublime_text.exe, save the script as a .bat file and run the script once.

@Echo OFF
SET path=C:\portable\sublimetext\sublime_text.exe
REG ADD "HKCR\*\shell\Open with Sublime Text 3" /V "" /D "Open with Sublime Text 3" /F 1>NUL
REG ADD "HKCR\*\shell\Open with Sublime Text" /V "Icon" /T "REG_EXPAND_SZ" /D "%path%,0" /F 1>NUL
REG ADD "HKCR\*\shell\Open with Sublime Text\command" /V "" /D "%path% \"%%1\"" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text" /V "" /D "Open with Sublime Text" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text" /V "Icon" /T "REG_EXPAND_SZ" /D "%path%,0" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text\command" /V "" /D "%path% \"%%1\"" /F 1>NUL
Add Sublime Text to context menu in Windows 10 illustration
Sublime Text 3 in Windows 10 context menu

Alternative 2: Command Prompt

Note that if you want to run this script directly in the command prompt (without a batch file) you will have to replace the double percentage signs with a single percentage. Like this:

SET path=X:\portable\sublimetext\sublime_text.exe
REG ADD "HKCR\*\shell\Open with Sublime Text" /V "" /D "Open with Sublime Text" /F 1>NUL
REG ADD "HKCR\*\shell\Open with Sublime Text" /V "" /D "Open with Sublime Text" /F 1>NUL
REG ADD "HKCR\*\shell\Open with Sublime Text" /V "Icon" /T "REG_EXPAND_SZ" /D "%path%,0" /F 1>NUL
REG ADD "HKCR\*\shell\Open with Sublime Text\command" /V "" /D "%path% \"%1\"" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text" /V "" /D "Open with Sublime Text" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text" /V "Icon" /T "REG_EXPAND_SZ" /D "%path%,0" /F 1>NUL
REG ADD "HKCR\Folder\shell\Open with Sublime Text\command" /V "" /D "%path% \"%1\"" /F 1>NUL

Set Sublime Text as the default text editor

You can use Notepad Replacer to set Sublime Text 3 as the default text editor software in Windows.

Leave a Reply

Your email address will not be published. Required fields are marked *