Skip to content

Instantly share code, notes, and snippets.

@Idered
Created August 5, 2015 20:25
Show Gist options
  • Save Idered/7274e64ff01176197bc2 to your computer and use it in GitHub Desktop.
Save Idered/7274e64ff01176197bc2 to your computer and use it in GitHub Desktop.
Add "Open with Sublime Text" command to file, folder and inside directory context menu.
@echo off
SET STPATH=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\sublime" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\sublime" /t REG_EXPAND_SZ /v "Icon" /d "%STPATH%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\sublime\command" /t REG_SZ /v "" /d "%STPATH% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\sublime" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\sublime" /t REG_EXPAND_SZ /v "Icon" /d "%STPATH%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\sublime\command" /t REG_SZ /v "" /d "%STPATH% \"%%1\"" /f
rem add it for directory
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\sublime" /t REG_SZ /v "" /d "Open with Sublime Text" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\sublime" /t REG_EXPAND_SZ /v "Icon" /d "%STPATH%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command" /t REG_SZ /v "" /d "%STPATH% \"%%V\"" /f
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment