Skip to content

Instantly share code, notes, and snippets.

@we684123
Created May 11, 2023 01:53
Show Gist options
  • Save we684123/0746b3df93d04c6c3dd12ae9a72cf935 to your computer and use it in GitHub Desktop.
Save we684123/0746b3df93d04c6c3dd12ae9a72cf935 to your computer and use it in GitHub Desktop.
將 Sublime Text 加入右鍵選單。 st3Path 要改成自己的,然後沒有雙引號!
@echo off
SET st3Path=C:\Program Files\Sublime Text\sublime_text.exe
rem 移除原本的
@reg delete "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text" /f
rem 為所有檔案類型新增
@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_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 為資料夾新增
@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_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
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3" /ve /f /d "Open with Sublime Text 3"
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3" /v "Icon" /f /d "%st3Path%,0"
@reg add "HKEY_CLASSES_ROOT\Directory\Background\shell\Open with Sublime Text 3\command" /ve /f /d "%st3Path% \"%%v\""
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment