Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Created May 17, 2026 17:18
Show Gist options
  • Select an option

  • Save primaryobjects/e542c268bf257165006d4970995e95dc to your computer and use it in GitHub Desktop.

Select an option

Save primaryobjects/e542c268bf257165006d4970995e95dc to your computer and use it in GitHub Desktop.
Add "Open with Sublime Text" to the Windows 10/11 Context Menu Right-Click
@echo off
SET "stPath=C:\Program Files\Sublime Text\sublime_text.exe"
rem Add it for all file types
reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /ve /d "Open with Sublime Text" /f
reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /v Icon /t REG_EXPAND_SZ /d "%stPath%,0" /f
reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command" /ve /d "\"%stPath%\" \"%%1\"" /f
rem Add it for folders
reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text" /ve /d "Open with Sublime Text" /f
reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text" /v Icon /t REG_EXPAND_SZ /d "%stPath%,0" /f
reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text\command" /ve /d "\"%stPath%\" \"%%1\"" /f
pause
@primaryobjects
Copy link
Copy Markdown
Author

Right-click the .bat and select "Run as Administrator".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment