Today's Question:  What are you most afraid of as a programmer?        GIVE A SHOUT

Technical Article => Operating System =>  Windows

Add Sublime Text to your context menu on right click

  sonic0002      2015-10-19 08:51:25      2,475    1    1

When opening a text file, you may be used to right click on the file to be opened and then choose the application which can open the file from the context menu. On the context menu, you may see a menu item like "Edit with Notepad++".

Nowadays many people especially programmers like to use Sublime Text, but by default this application will not show on the context menu when you right click on a file. There is now frequent request to add this application to the context menu. Here we show a simple batch file which can help you achieve this.

Below is the batch code :

@echo off
SET sublimeTextPath=C:\Program Files\Sublime Text 3\sublime_text.exe

REM ADD REGISTRY KEYS
@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 "%sublimeTextPath%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%sublimeTextPath% \"%%1\"" /f

pause

You just need to copy above code into the text editor you like and save it as a batch file. Note, please change the sublimeTextPath to the sublime_text.exe on your system. Then, what you need to do is right click on the batch file you saved and "Run as administrator" and it should show below:

This means you have successfully added Sublime Text to your context menu. Then you can verify this by right clicking on any text file and you should see below:

Please note that you need to run the batch file as administrator, otherwise you will see errors on the command line console.

WINDOWS SUBLIME TEXT CONTEXT MENU

  SAVE AS PDF   MARK AS READ   MARK AS IMPORTANT

Share on Facebook  Share on Twitter  Share on Google+  Share on Weibo  Share on Reddit  Share on Digg  Share on Tumblr    Delicious

  RELATED


  1 COMMENT


Simon Suh [Reply]@ 2016-10-02 15:41:03

Thanks, this helped me add the option to the control menu.


  WRITE ARTICLE

Mathematician loses to barman

By sonic0002