1. 程式人生 > >Open with Sublime text 3

Open with Sublime text 3

原文連結

把Sublime text 新增到右鍵選單中。

  1. 新建文字檔案,將以下內容複製並貼上到新建的文字檔案中,儲存並退出。

注意:第二行的SET st3Path= 後面填的是你的sublime text 的安裝路徑。

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

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

pause
  1. 將新建的文字檔案重新命名為A.bat。
  2. 右擊A.bat,選擇以管理員身份執行,執行結束後sublime text 就新增到右鍵選單中了。