Skip to content

Instantly share code, notes, and snippets.

@XrXr
Forked from mrchief/LICENSE.md
Last active August 29, 2015 14:03
Show Gist options
  • Save XrXr/7648cd233e7f68a4fa8d to your computer and use it in GitHub Desktop.
Save XrXr/7648cd233e7f68a4fa8d to your computer and use it in GitHub Desktop.
Add right click item to folders and files, also the right click menu of background area inside a folder
@echo off
SET st3Path=E:\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
rem add it for folder backgrounds
@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Open Sublime Text 3 here" ^
/t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Open Sublime Text 3 here" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Open Sublime Text 3 here\command" ^
/t REG_SZ /v "" /d "%st3Path% \"./\"" /f
rem the command key for this works a bit differently. If "%1" is used, an error will come up. "./" works though.
pause
@echo off
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /f
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /f
@reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\Open Sublime Text 3 here" /f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment