Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@echo off
rem Based on a gist for adding sublime text 2:
rem https://gist.github.com/mrchief/5628677
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with ST3" /t REG_SZ /v "" /d "Open with ST3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with ST3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with ST3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with ST3" /t REG_SZ /v "" /d "Open with ST3" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with ST3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with ST3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
@reg add "HKEY_CLASSES_ROOT\directory\background\shell\Open with ST3" /t REG_SZ /v "" /d "Open with ST3" /f
@reg add "HKEY_CLASSES_ROOT\directory\background\shell\Open with ST3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\directory\background\shell\Open with ST3\command" /t REG_SZ /v "" /d "%st3Path% \"%%V\"" /f
pause
@Atid-Gharbi

This comment has been minimized.

Copy link

commented Aug 12, 2015

Hi, it works fine with files, but with folders it opens 2 sublime text windows. Any idea how to fix this? I'm on windows 10

@TechplexEngineer

This comment has been minimized.

Copy link

commented Aug 25, 2015

@Atid-G The reason you are seeing two Sublime windows open is because you have a feature called Hot Exit enabled. This lets you exit Sublime and have it remember the state of your open files.

The way I got around this issue is to add the following two options to the Preferences.sublime-settings file

    "remember_open_files": false,
    "hot_exit": false

Incase you don't know Preferences.sublime-settings lives in your sublime user directory. To access this Open Sublime, click Preferences, then Browse Packages.., then double click the User folder. Here is where you should create Preferences.sublime-settings if it doesn't already exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.