Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\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 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
pause
@viktorlindgren

This comment has been minimized.

Copy link

commented Jun 9, 2013

THX

@ahrib

This comment has been minimized.

Copy link

commented Jun 17, 2013

Thanks, this is awesome

@bjerkins

This comment has been minimized.

Copy link

commented Jul 31, 2013

Thanks!

@elliotwoods

This comment has been minimized.

Copy link

commented Aug 7, 2013

great

@erikcox

This comment has been minimized.

Copy link

commented Aug 8, 2013

Works perfect. Even has an icon; nice touch. Thanks!

@helpse

This comment has been minimized.

Copy link

commented Aug 15, 2013

Incredible :)

@jukebox017

This comment has been minimized.

Copy link

commented Aug 20, 2013

At first, I got a bunch of access denieds.
But then I ran it as an administrator.
Silly Windows 7 :)

@rhali786

This comment has been minimized.

Copy link

commented Sep 11, 2013

The icon isn't showing for me..
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
@reg add "HKEY_CLASSES_ROOT*\shell\Open with Sub
lime Text 2" .gitk /t REG_EXPAND_SZ /v "Icon" /d "%~dp0sublime_text.exe,0" /f

Completes successfully, but C:\Program Files\Sublime Text 2\sublime_text.exe,0 does not result in an icon.

@pebreo

This comment has been minimized.

Copy link

commented Sep 21, 2013

Excellent! Thanks for sharing this

@phoenixstudio

This comment has been minimized.

Copy link

commented Sep 23, 2013

thanks!

@rubenbristian

This comment has been minimized.

Copy link

commented Sep 27, 2013

Thanks! This is a really great addition to Sublime Text!

@romdim

This comment has been minimized.

Copy link

commented Oct 10, 2013

Thank you!!!

@samuelmf

This comment has been minimized.

Copy link

commented Oct 25, 2013

Excellent, works for Sublime Text 3 too, just changing the program path. Thanks

@philippotto

This comment has been minimized.

Copy link

commented Nov 3, 2013

thanks!

@colingaj

This comment has been minimized.

Copy link

commented Nov 5, 2013

Excellent!

@albertinix

This comment has been minimized.

Copy link

commented Nov 7, 2013

Thanks! Quick'n'dirty solution, just what I needed.

@jcramirez

This comment has been minimized.

Copy link

commented Nov 19, 2013

Thank you, this works very nicely. Keep up the good work.

@aguirrem

This comment has been minimized.

Copy link

commented Jan 5, 2014

Short and simple. Thank you!

@JunaidQadirB

This comment has been minimized.

Copy link

commented Jan 9, 2014

I'm on win8.1 so I had to add things manually to the Registry.
Here's the exported reg file in case you are on a windows with Registry Editor v5:

Please make sure your ST2 installation paths match.

file: st2_shell.reg

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2]
@="Open with Sublime Text 2"
"Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
  00,46,00,69,00,6c,00,65,00,73,00,5c,00,53,00,75,00,62,00,6c,00,69,00,6d,00,\
  65,00,20,00,54,00,65,00,78,00,74,00,20,00,32,00,5c,00,73,00,75,00,62,00,6c,\
  00,69,00,6d,00,65,00,5f,00,74,00,65,00,78,00,74,00,2e,00,65,00,78,00,65,00,\
  2c,00,30,00,00,00

[HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2\command]
@="C:\\Program Files\\Sublime Text 2\\sublime_text.exe \"%1\""

[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2]
@="Open with Sublime Text 2"
"Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
  00,46,00,69,00,6c,00,65,00,73,00,5c,00,53,00,75,00,62,00,6c,00,69,00,6d,00,\
  65,00,20,00,54,00,65,00,78,00,74,00,20,00,32,00,5c,00,73,00,75,00,62,00,6c,\
  00,69,00,6d,00,65,00,5f,00,74,00,65,00,78,00,74,00,2e,00,65,00,78,00,65,00,\
  2c,00,30,00,00,00

[HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command]
@="C:\\Program Files\\Sublime Text 2\\sublime_text.exe \"%1\""

please don't hold me responsible in case of any incident.

@jcppkkk

This comment has been minimized.

Copy link

commented Jan 9, 2014

​Improved Version

  • ​Open File with Sublime Text
  • ​Open File with Sublime Text as Admin
  • ​Open Folder with Sublime Text
    ​Execute .bat Script where Sublime Text installed.

https://gist.github.com/jcppkkk/8330314

@nazarov-tech

This comment has been minimized.

Copy link

commented Jan 12, 2014

works just fine :) for #st3 you just need to replace all these '2' to '3'.

@leonardinius

This comment has been minimized.

Copy link

commented Jan 22, 2014

Thanx

@treckstar

This comment has been minimized.

Copy link

commented Feb 10, 2014

This is fantastic, thanks!

@LongYC

This comment has been minimized.

Copy link

commented Feb 14, 2014

Thank you for sharing, you saved us a lot of time.

@ExtremeGTX

This comment has been minimized.

Copy link

commented Feb 19, 2014

Works Great, Thanks

@volyx

This comment has been minimized.

Copy link

commented Feb 20, 2014

Thnx!

@braceandbracket

This comment has been minimized.

Copy link

commented Feb 27, 2014

Solid work sir!

@dejwid

This comment has been minimized.

Copy link

commented Mar 2, 2014

I love you, mate!

@awahlig

This comment has been minimized.

Copy link

commented Mar 6, 2014

I'm also using the "--new-window" argument to open the file in a new window. I usually have my project open in sublime and I usually don't want other files appearing there.

@cainux

This comment has been minimized.

Copy link

commented Mar 22, 2014

Thanks so much for this!

@ghost

This comment has been minimized.

Copy link

commented Mar 30, 2014

Thanks!

@pingxumeng

This comment has been minimized.

Copy link

commented Apr 18, 2014

Works fine . thanks

@marcelodeandrade

This comment has been minimized.

Copy link

commented May 19, 2014

Thank's a lot!

@igal-getrailo

This comment has been minimized.

Copy link

commented Jun 30, 2014

This is great, thanks!

See also https://gist.github.com/jcppkkk/8330314 which adds an option to Open As Administrator

@kristinpeterson

This comment has been minimized.

Copy link

commented Jul 2, 2014

Just what I was looking for, thanks!!!

@hiun

This comment has been minimized.

Copy link

commented Jul 20, 2014

You rocks!!!

@bayrock

This comment has been minimized.

Copy link

commented Jul 28, 2014

Thanks for this. Does anyone know how I can remove the context menu from certain extensions? For example I don't need to open the Recycle Bin with Sublime.

Or maybe limit it to certain extensions instead? For example so I could only add this context menu to .lua files.

Otherwise if that can't be done how could I change the order in which it appears? For example so that I could have 'Open with Sublime Text 3' appear underneath 'Empty Recycle Bin' to make it less prominent.

@PatrickMcDonald

This comment has been minimized.

Copy link

commented Aug 5, 2014

@bayrock If you replace HKEY_CLASSES_ROOT\Folder\shell with HKEY_CLASSES_ROOT\Directory\shell then the Open with Sublime Text command only appears in the context menus of physical directories and not on virtual folders (like drives, Recycle Bin, Control Panel, etc.)

@ViZioN8

This comment has been minimized.

Copy link

commented Aug 12, 2014

Thanks a lot. Works great for ST2

@ftobares

This comment has been minimized.

Copy link

commented Aug 13, 2014

Thanks a lot! Very helpful !

@olanchuy

This comment has been minimized.

Copy link

commented Sep 8, 2014

Can anyone tell me how to do this? where to add? a tutorial maybe? thanks :)

@sjurlur

This comment has been minimized.

Copy link

commented Sep 9, 2014

Thanks!
olanchuy: download file, right click and select "run as administrator".

@rustamli

This comment has been minimized.

Copy link

commented Sep 14, 2014

Awesome, thank you!

@zaccharles

This comment has been minimized.

Copy link

commented Sep 22, 2014

Cool, works perfectly with Windows 7 and Sublime Text 3 (with path modification, of course). Thanks!

@lukaMis

This comment has been minimized.

Copy link

commented Sep 24, 2014

Cool, works perfectly with Windows 7 and Sublime Text 3 (with path modification, of course).
Thanks!

+1

@EdwinSaenz

This comment has been minimized.

Copy link

commented Sep 29, 2014

Worked perfectly for me and Sublime Text 3. Thank you!

@danielpsf

This comment has been minimized.

Copy link

commented Oct 8, 2014

Thanks man!

@zur4ik

This comment has been minimized.

Copy link

commented Oct 27, 2014

Works perfectly on Windows 8.1
Thanks a lot!

@Oussama-Tn

This comment has been minimized.

Copy link

commented Oct 29, 2014

Hi, Thanks!
But, I'm having an issue.. when I close sublime and try to open another folder, it opens two windows: The last project and the new one. Any suggestion? Thanks

@ale87kb

This comment has been minimized.

Copy link

commented Nov 4, 2014

Thanks!!

@nadirakdag

This comment has been minimized.

Copy link

commented Dec 7, 2014

awesome thanks

@cberigan

This comment has been minimized.

Copy link

commented Dec 18, 2014

Amazing. Thanks!!

@arshmakker

This comment has been minimized.

Copy link

commented Dec 23, 2014

awesome dude... thanks.. pushes me to switch to sublime... more and more

@ekosukmo

This comment has been minimized.

Copy link

commented Dec 26, 2014

WORK for me. Is possible to replace "Open with Sublime Text 3" with my own languange? thanks

@gccpacman

This comment has been minimized.

Copy link

commented Jan 1, 2015

it works on my win8.1 x64, too. that is amazing!

@truongduyng

This comment has been minimized.

Copy link

commented Jan 10, 2015

thanks, pro! But if I want to remove it, how can i do?

@arnaudoff

This comment has been minimized.

Copy link

commented Jan 11, 2015

Thanks, amazing.

@nitin7dc

This comment has been minimized.

Copy link

commented Jan 14, 2015

thanks

@aronayne

This comment has been minimized.

Copy link

commented Jan 22, 2015

Extremely handy, thanks.

@CJEdgerton

This comment has been minimized.

Copy link

commented Feb 11, 2015

Arigatou muchos! The open folder context menu has been such a pain to navigate on Windows, this is a great solution.

@squarewave24

This comment has been minimized.

Copy link

commented Feb 17, 2015

worked like a charm, thanks!

@nssy

This comment has been minimized.

Copy link

commented Feb 20, 2015

Much appreciated.

@elbym

This comment has been minimized.

Copy link

commented Feb 23, 2015

Super Handy! Thank you very much.

@SteveBlodgett

This comment has been minimized.

Copy link

commented Mar 18, 2015

Thank you.

@hwdegroot

This comment has been minimized.

Copy link

commented Mar 27, 2015

Thanks. Works like a charm

@hulinghuan

This comment has been minimized.

Copy link

commented Mar 31, 2015

Work as expected! Thanks!

@folger

This comment has been minimized.

Copy link

commented Apr 1, 2015

Thanks very much!

@ronammar

This comment has been minimized.

Copy link

commented Apr 2, 2015

Beauty!

@MohamedMahmoud299

This comment has been minimized.

Copy link

commented Apr 6, 2015

Amazing!

@DanielGGordon

This comment has been minimized.

Copy link

commented Apr 17, 2015

Ah shoot I use sublime text 3 not 2. So now I actually have 2 options: open with sublime text 2 and 3. However they both do the same thing... How to fix?

@vitalii-vitrenko

This comment has been minimized.

Copy link

commented May 9, 2015

I think in the last line should be %1 instead of %%1. No?

@nelreina

This comment has been minimized.

Copy link

commented May 11, 2015

Many many tnxs

@alambley

This comment has been minimized.

Copy link

commented May 20, 2015

Fantastic.

@gccpacman

This comment has been minimized.

Copy link

commented May 22, 2015

Very useful thanks.
It also works with sublime text 3.

@tobiashochguertel

This comment has been minimized.

Copy link

commented May 31, 2015

Thank you 😄

@atheiman

This comment has been minimized.

Copy link

commented Jun 1, 2015

my god this is so much easier on a mac..

@D0zingcat

This comment has been minimized.

Copy link

commented Jun 2, 2015

Tks! Awesome work! That helps me a lot! A little more easier XD

@pstoev

This comment has been minimized.

Copy link

commented Jun 17, 2015

Here's the version for Sublime Text 3 with additional option that shows up when showing current folder's context menu. https://gist.github.com/pstoev/feaf7797cd795cff72a5

@abhisheksoni27

This comment has been minimized.

Copy link

commented Jun 22, 2015

Works. Cheers!

@Juni4567

This comment has been minimized.

Copy link

commented Jul 10, 2015

I have opened it several times and I see multiple lines of "open with sublime text 2" What should i do, please help!

@Juni4567

This comment has been minimized.

Copy link

commented Jul 10, 2015

For those who has created multiple context menu items like me can fix here http://gamier.blogspot.com/2015/07/fix-multiple-context-menu-items-for-sublime-text.html

@accidentallyc

This comment has been minimized.

Copy link

commented Jul 21, 2015

I really want to star this but for some reason it keeps giving " Something went wrong with that request. Please try again."

@katlimruiz

This comment has been minimized.

Copy link

commented Aug 4, 2015

As is the original, it worked for win8.1.

very cool with icon!!!

@meichthys

This comment has been minimized.

Copy link

commented Sep 10, 2015

As mentioned before, it worked for Sublime Text 3 - all i needed to do was change all the 2's to 3's in the file.

@mathisto

This comment has been minimized.

Copy link

commented Sep 30, 2015

Thank you so much sir. This was very helpful.

@RaphaelSanches

This comment has been minimized.

Copy link

commented Oct 10, 2015

Thank you so much, guy. This works perfectly on Windows 8 with Sublime Text 2.

@roguegerbil

This comment has been minimized.

Copy link

commented Nov 19, 2015

With edits for Sublime Text 3 and directories (vs. folders) -

@echo off
SET st3fqfn=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 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 "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%1\"" /f

rem add it for directories
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%1\"" /f

pause

Works great on Windows 8 Pro.

Thanks mrchief for the original submission!

@trungtin

This comment has been minimized.

Copy link

commented Nov 23, 2015

including directory background :)

@echo off
SET st3fqfn=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 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 "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%1\"" /f

rem add it for directories
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%1\"" /f

rem add it for directories background
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3"         /t REG_SZ /v "" /d "Open with Sublime Text 3"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3"         /t REG_EXPAND_SZ /v "Icon" /d "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%V\"" /f
pause
@BernardoGO

This comment has been minimized.

Copy link

commented Nov 29, 2015

Thank you

@nico78

This comment has been minimized.

Copy link

commented Dec 17, 2015

perfect, Thanks

@mtalis

This comment has been minimized.

Copy link

commented Dec 23, 2015

It works! Thanks you!

@kiglaze

This comment has been minimized.

Copy link

commented Dec 28, 2015

Hi, I saved this .bat file on my computer and ran it from the cmd window. It said "ERROR: Access is denied." six times. How do I get around this?? Thank you.

@chalubhalu

This comment has been minimized.

Copy link

commented Jan 4, 2016

@kiglaze You need administrator privilege to modify registry keys. Run you cmd in admin mode.

@steven-lam

This comment has been minimized.

Copy link

commented Jan 15, 2016

Got it to work with sublime text 3; Thanks a lot!

@thesafetylemur

This comment has been minimized.

Copy link

commented Feb 5, 2016

Worked like a charm. Thanks!

@Nabnab9

This comment has been minimized.

Copy link

commented Feb 11, 2016

Thanks, works great !

@HellfireXD

This comment has been minimized.

Copy link

commented Feb 24, 2016

For PowerShell fans, I have created a PowerShell script based on the registry entries in this script as well as a few forks.
Unfortunately i cannot fork to another file type.

https://gist.github.com/HellfireXD/7f8c5a0845a44dfa9e7d

@jreigel

This comment has been minimized.

Copy link

commented Mar 3, 2016

Awesome. Thanks for sharing.

@jaroberts-krittermedia-com

This comment has been minimized.

Copy link

commented Mar 30, 2016

without admin right, boo, no luck

@gurkan0791

This comment has been minimized.

Copy link

commented Apr 3, 2016

Thanks. work win10

@troyxuanyichen

This comment has been minimized.

Copy link

commented Apr 25, 2016

It's really cool! You just have to modify the path of your sublime.Thanks!

@AmirGeorge

This comment has been minimized.

Copy link

commented May 7, 2016

This is very useful, thanks a lot!

@shawnthompson

This comment has been minimized.

Copy link

commented Jun 23, 2016

Thank you very much 👍

@HKhademian

This comment has been minimized.

Copy link

commented Jun 24, 2016

(from my other gist comment)
This is a better command. save it to a bat file in app directory and run as administrator.
U can use this command for another applications like Atom,VSCode,... simply by changing App* lines

@echo off
SET AppKey=SublimeText3
SET AppTitle=Open with Sublime Text 3
SET AppPath=%~dp0sublime_text.exe
SET AppIcon=%AppPath%,0

REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /ve /f /d "%AppTitle%"
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
REG ADD "HKEY_CLASSES_ROOT\*\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%1\""

REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%" /ve /f /d "%AppTitle%"
REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
REG ADD "HKEY_CLASSES_ROOT\Folder\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%v\""

REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%" /ve /f /d "%AppTitle%"
REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%" /v "Icon" /f /d "%AppIcon%"
REG ADD "HKEY_CLASSES_ROOT\Directory\Background\shell\%AppKey%\command" /ve /f /d "%AppPath% \"%%v\""
@hasham7861

This comment has been minimized.

Copy link

commented Aug 14, 2016

👍

@pksingh-pro

This comment has been minimized.

Copy link

commented Dec 29, 2016

Works like a charm. Excellent work.

@Dengjiansheng

This comment has been minimized.

Copy link

commented Jan 9, 2017

Thank you

@alexanek

This comment has been minimized.

Copy link

commented Feb 8, 2017

Cool

@jehrenzweig

This comment has been minimized.

Copy link

commented Feb 9, 2017

You just solved a problem I've been having for months, if not years. Thank you!

@Zihad-Dmrt

This comment has been minimized.

Copy link

commented Feb 17, 2017

How can i Remove this function after uninstall sublime text 2...... please help me

@mrchief

This comment has been minimized.

Copy link
Owner Author

commented Mar 2, 2017

Just delete those reg entries or use a registry cleaner

@klendi

This comment has been minimized.

Copy link

commented Apr 12, 2017

when i right click recycle bin it shows edit with sublime text, how to remove that and make this work only with the files?

@mittalyashu

This comment has been minimized.

Copy link

commented Jul 17, 2017

It just works on a file. What about the folder?

What if we want to open a whole folder in sublime? ("Open as Sublime Text Project")

@mittalyashu

This comment has been minimized.

Copy link

commented Jul 17, 2017

I somehow managed to find on internet and created a new gist.

In this gist you can create keys to open file and folders in sublime.

@ZubairKarim

This comment has been minimized.

Copy link

commented Jul 23, 2017

WoW, very nice solution

@gtalarico

This comment has been minimized.

Copy link

commented Sep 11, 2017

Minor Fix:

  1. Add Quotes path to allow file paths with spaces
  2. Added Option to "Open Sublime Here" to allow right clicking on directory background (
@echo off
SET st3Path=\"C:\Users\gtalarico\Dropbox\Shared\_Common\_Portable Apps\Sublime3\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 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 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 background
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3 Here"         /t REG_SZ /v "" /d "Open Sublime 3 Here"   /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3 Here"         /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3 Here\command" /t REG_SZ /v "" /d "%st3Path% \"%%V\"" /f
pause

image

@muhammadsaeid

This comment has been minimized.

Copy link

commented Oct 26, 2017

it's work for linux ?

@mittalyashu

This comment has been minimized.

Copy link

commented Oct 30, 2017

Everything works fine.

But I have one problem and that is if we select a directory and open in Sublime Text.
The probme is that it open's that directory in new sublime window.

I want to append that directory in the existing sublime window.

@adarshanand123

This comment has been minimized.

Copy link

commented Mar 8, 2018

Very very Thanks.I reduced my work.

@1j01

This comment has been minimized.

Copy link

commented Jul 28, 2018

Remove / uninstall for the original script:

@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe

rem remove it for "all file types"
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /f

rem remove it for folders
@reg delete "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /f
pause
@silviuvulcan

This comment has been minimized.

Copy link

commented Dec 13, 2018

License?

I want to fork https://github.com/jcppkkk/OpenWithSublime to create a similar set of scripts for Visual Basic Code. Asked him about license and he pointed that his scripts are forked from https://gist.github.com/FoxColdMetal/7403764 which are forked from these. So what license would it be ? :)

@whalehub

This comment has been minimized.

Copy link

commented Jan 3, 2019

@mrchief I would be interested in finding out the license of this code as well.

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.