Skip to main content

Command Palette

Search for a command to run...

Help! Where is my Sublime Context Menu option

Updated
1 min read

After I upgraded to Windows 11, my Sublime Text right-click context menu disappeared. Putting this here for my future reference, and hope it helps the next person. Cheers!

@echo off
REM Add Sublime Text to Windows 11 Right-Click Context Menu
REM Run this batch file as Administrator

echo Adding Sublime Text to context menu...
echo.

REM Check if Sublime Text exists at the specified path
if not exist "C:\Program Files\Sublime Text\sublime_text.exe" (
    echo ERROR: Sublime Text not found at "C:\Program Files\Sublime Text\sublime_text.exe"
    echo Please verify the installation path.
    echo.
    pause
    exit /b 1
)

REM Add context menu for folders
reg add "HKEY_CLASSES_ROOT\Directory\shell\OpenWithSublime" /ve /t REG_SZ /d "Open with Sublime Text" /f
reg add "HKEY_CLASSES_ROOT\Directory\shell\OpenWithSublime" /v "Icon" /t REG_SZ /d "C:\\Program Files\\Sublime Text\\sublime_text.exe,0" /f
reg add "HKEY_CLASSES_ROOT\Directory\shell\OpenWithSublime\command" /ve /t REG_SZ /d "\"C:\\Program Files\\Sublime Text\\sublime_text.exe\" \"%%1\"" /f

REM Add context menu for folder background (right-click inside folder)
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithSublime" /ve /t REG_SZ /d "Open with Sublime Text" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithSublime" /v "Icon" /t REG_SZ /d "C:\\Program Files\\Sublime Text\\sublime_text.exe,0" /f
reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\OpenWithSublime\command" /ve /t REG_SZ /d "\"C:\\Program Files\\Sublime Text\\sublime_text.exe\" \"%%V\"" /f

echo.
echo Sublime Text has been added to the context menu!
echo You can now right-click on folders to open them in Sublime Text.
echo.
pause