Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Windows 7, I can do this at the command line:

"c:\Program Files\Sublime Text 2\sublime_text.exe" samplefolder

This launches a Sublime Text window, with the contents of samplefolder loaded in Sublime's sidebar.

While this works as needed, it's inconvenient to open a command prompt every single time. Is there any way I can add this behavior to Windows Explorer's right-click menu? I'd like to be able to right-click a folder and "Open with Sublime" just like I can right-click a folder and "Scan for viruses".

share|improve this question
up vote 47 down vote accepted

This is my .reg file for Vim, but it's quite clear, just replace Vim related string with Sublime's. Then save as .reg file and double click to import.

Windows Registry Editor Version 5.00

@="&Vim here"

@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%1\""

@="&Vim here"

@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%V\""

There are two folder context menu, one is direct right click on folder, that's the first two lines, and another one is in folder empty area right click, that's the last two lines. I don't know what did the last %V mean, and haven't found anything related, it just works.


For default installation of Sublime Text 2 on Windows 7, here is the full code. Save as whatever.reg and double-click.

Windows Registry Editor Version 5.00

; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear

@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"

@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%1\""

; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear

@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"

@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%V\""
share|improve this answer
I added the key (with %1 at the end) by hand to HKEY_CLASSES_ROOT\Directory\shell\ and it worked. Thanks! Skipping the second line (with %V at the end) for the time being. – George P. Burdell Apr 14 '12 at 11:00
Really useful. Thanks a lot! – José Tomás Tocino Sep 20 '12 at 0:09
Note: if you're using Sublime Text 2, make sure you replace Sublime Text with Sublime Text 2 – Chris Fletcher Dec 5 '12 at 19:08
How do they do those little icons? – Aditya M P Jan 20 '13 at 0:14
+1 This worked great. However, I added the ability to edit single files. I put all of this in a repo over here: – cbmeeks Apr 12 '13 at 20:16

I found a super solution posted on github gist by Jethro Yu

Installation instructions:

  • Download the OpenWithSublimeTextAsAdmin.bat file in that gist.
  • Copy it into your Sublime Edit installation folder (typically C:\Program files\Sublime Text 3 or similar)
  • Run it.


  • Super easy installation.
  • Open files with Sublime Text
  • Open files with elevated privileges with Sublime Text. This is particularly handy when you want to edit i.e. system files.
  • Open folders with Sublime Text
share|improve this answer

You should be able to just open regedit.exe and browse to:


Right-click on "shell" and choose to create a new key, calling it "Open with Sublime Text".

Create a new key below that one called "command".

Double-click on the (Default) value in the right-hand pane and enter in the following:

[sublime text .exe name] %1

share|improve this answer
This only works for opening files. It doesn't work for opening folders. – Kristopher Johnson Jan 15 '13 at 17:23

This is what I do

I install Notepad Replacer and point that to my sublime_text.exe (or any other text editor).

I then add the 'Open with Notepad' Registry setting (copy and paste the following into a .reg file and double click to apply it.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Open with Notepad]

[HKEY_CLASSES_ROOT\*\shell\Open with Notepad\command]
@="notepad.exe %1"

What Notepad Replacer does is replaces any command (system wide) to open notepad.exe to open the text editor that you specified in the install (in this case sublime_text.exe).

If you uninstall Notepad Replacer or re-install it pointing to a different text editor, your 'Open with Notepad' context menu will still work with the new default text editor!

share|improve this answer
@echo off
@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "\"%~dp0sublime_text.exe\",0" /f
@reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\Sublime Text 2\command" /t REG_EXPAND_SZ /v "" /d "\"%~dp0sublime_text.exe\" \"%%1\"" /f

how to use

new a *.bat file

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .