Can I right-click a folder in Windows 7 and choose "Open with Sublime Text"?

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

[HKEY_CLASSES_ROOT\Directory\shell\vim]
@="&Vim here"

[HKEY_CLASSES_ROOT\Directory\shell\vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim73\\gvim.exe\" \"%1\""

[HKEY_CLASSES_ROOT\Directory\Background\shell\vim]
@="&Vim here"

[HKEY_CLASSES_ROOT\Directory\Background\shell\vim\command]
@="\"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.

Edit:

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

[HKEY_CLASSES_ROOT\Directory\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"

[HKEY_CLASSES_ROOT\Directory\shell\sublime\command]
@="\"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

[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime]
@="Open Folder as &Sublime Project"
"Icon"="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\",0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\sublime\command]
@="\"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\" \"%V\""

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.

Features:

  • 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