20
How to open any folder with Sublime Text 3 in Windows.
Hi, this is my first post/tutorial. I hope you enjoy it and find it useful. In this tutorial I will be adding Sublime Text 3 to your right click menu (Context menu), so you can open files/folders in Sublime Text 3, just like you would with VScode.
In this tutorial I am using Windows 10, but you should be able to achieve the same result in Windows 8/8.1 and 7.
- WIN+R keyboard shortcut.
- run "regedit.exe".
- copy pasting into the address bar at the top:
HKEY_CLASSES_ROOT\Directory\Background
- Inside the
shell
folder, create a new key and call it: "Open with Sublime Text 3" (or whatever you'd like to call it) - Make another new key inside of this and call it: "command"
- Modify the key to edit the data value of this new key.
Put the path for your computers version of Sublime Text 3. For me it is:
C:\Program Files\Sublime Text\sublime_text.exe .
Make sure to have a full stop at the end. The full stop as a flag tells windows to open this folder/directory in Sublime Text 3.
- Test it in any folder you like.
- Done.
P.S A more detailed version of this TL;DR with images can be seen at Step 5.
In order to edit or add a new item to your right click menu.
You will need edit the Windows Registry to change a setting/registry key for your Windows operating system.
You will need to open/start the Windows "run.exe" and search for the "regedit.exe" in the input field. Once you type that in click "Ok". You can also use WIN+R keyboard shortcut to access "run.exe".
Once you run "regedit.exe" you will have a new window appear in front of you. This is called the Registry Editor
⚠️WARNING⚠️ Editing the Windows Registry incorrectly could do damage to your computer's operating system. So please take care from this point forward, and make a back up in case something goes wrong. Thankfully to make a back up is fairly easy.
Now with your fancy new backup, you can edit your registry with glee.
You now need to navigate to/look for a folder called:
HKEY_CLASSES_ROOT\*\shell\
Now you will see a list of different folders. These should be different for you, depending on what you have installed on your computer.
If you have Sublime Text 3 installed, there should be a folder already here for you to see.
To see what this does, look for a file on your computer and right click on it you should see something like this:
As a test you can edit this file/registry key to change the name and see the change on your right click menu.
Now you might be asking yourself.
"That's great John, but why should I bother editing something that is already installed by Sublime Text 3?"
I am glad you asked that. Because yes it would seem pointless to edit something for your benefit that is already there. But there is a limit to this "Open with Sublime Text 3" option, that I hope to resolve.
This isn't provided to you by default or on install. And there was many times I wanted that option. So why not add it now?
You may notice it's with a a lot of other folders so for speed I recommend typing/copy pasting into the address bar at the top:
HKEY_CLASSES_ROOT\Directory\Background
and it should take you right there.
Call it: "Open with Sublime Text 3" (or whatever you'd like to call it)
Now you need to add the system path for your computers version of Sublime Text 3. For me it is:
C:\Program Files\Sublime Text\sublime_text.exe
Your installation might be different.
And one very important thing to add at the end of:
C:\Program Files\Sublime Text\sublime_text.exe
is a full stop .
I know my screen shot above isn't very clear but adding the full stop as a flag tells windows to open this folder/directory in Sublime Text 3.
This is the full path:
C:\Program Files\Sublime Text\sublime_text.exe .
And this is as far as you need to go, you can now open Sublime Text 3 (or any program you want really) with the right click context menu. Congratulations!
Yes with the " " around the path.
Top
- If you want the position to be at the bottom. Set the value to:
Bottom
This post came from my own desire to add Sublime Text 3 to the Windows context menu and open it in any folder I wanted. What I thought would be a simple thing turned out to be fairly difficult for me and a lot of DuckDuckGo later, I am here. This post is my documentation of the process so it's available for me in the future and I hope it is helpful to you. Dear reader. :D
To this fantastic stackoverflow question and discussion giving me a lot of help and guidance on how to add an icon to my new context menu item.
To this Techspot article going a bit more in depth with images and pointing myself the right direction to really flesh things out.
To this Livewire article. Going deep on what a registry key and how to edit them.
- Windows 7/8/10: Windows is the operating system that is being used in this tutorial, (7/8/10) is the version of the operating system link to Wikipedia article
Context menu: A small box/menu that appears when you right click anywhere in a Windows operating system.
Windows Registry: The registry in windows is the place that store all of your windows computer software settings. stuff like: hardware devices, user preferences, and operating-system configurations. link to detailed explainion
HKEY_CLASSES_ROOT is the global "hive"/folder that holds the all the information that effects all users on that computer. Similar to a global variable/root directory that you can edit.
Environment variables are surrounded by the percent sign (%), as in %temp%, to distinguish them from regular text. You can reference user variables and system variables as we did in the "Opening the folder with custom file name/date:"
20