Skip to content

Instantly share code, notes, and snippets.

@drewlustro
Forked from mrchief/LICENSE.md
Last active October 6, 2022 05:04
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drewlustro/1a67948fade4264df83d to your computer and use it in GitHub Desktop.
Save drewlustro/1a67948fade4264df83d to your computer and use it in GitHub Desktop.
"Open with Sublime Text" Windows context menu, works with portable sublime text
@echo off
SET st2Path=C:\Users\drew\Dropbox\Windows\Sublime Text Build 3083 x64\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause
@prabapro
Copy link

Worked like charm (tested on Win_10_x64). Thank you @drewlustro

@emilioTejada
Copy link

Perfect on Windows 10 x64. Thank you

@nicklleite
Copy link

nicklleite commented May 6, 2019

Perfect on Windows 10 x64. (Repeating just for the sake of statistics :D)

@goforgold
Copy link

Is there a way to run in without admin rights and make it work only for the current user? I do not have admin rights on the machine and that is the primary reason to work with portable release.

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