SublimeText open folder from Explorer

Veröffentlicht von

How can I add “Open folder to sublime text” in Windows Explorer?

One thing I like about VisualStudio Code is that I can open a folder from the Explorer. This will open Code and the corresponding folder for editing files in it.

SublimeText adds this function only for files by default. Since Sublime is much faster than VisualStudio Code I wanted the same function for Sublime as well. I found a Gist on Github, which added the needed registry keys for Sublime Text 2.

I forked the Gist here and changed it for Sublime Text 3.

The code:

@echo off
SET st2Path=C:\Program Files\Sublime Text 3\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

This needs to be saved to a batch file, which sets the registry keys when run with admin rights.

After that you can also open folders from the Explorer:

Kommentar hinterlassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.