Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sublime text window下右键菜单。保存为bat文件,放入sublimetext安装文件夹与sublime_text同级,双击执行即可。能打开带空格文件夹下的文件。 注意:这个文件最好是复制并用记事本保存,直接下载的有可能存在换行问题导致不能正常使用。
@Echo Off
Title SublimeText 右键菜单维护
Pushd %~dp0
If "%PROCESSOR_ARCHITECTURE%"=="AMD64" (Set a="HKLM\SOFTWARE\Wow6432Node\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\SysWOW64) Else (Set a="HKLM\SOFTWARE\SublimeText\sublimetext_backwnd" /v&Set b=%SystemRoot%\system32)
Rd "%b%\test_permission" >nul 2>nul
Md "%b%\test_permission" 2>nul||(Echo 请使用右键管理员身份运行&&Pause >nul&&Exit)
Rd "%b%\test_permission" >nul 2>nul
:START
CLS
Echo *=========================================================================*
Echo * *
Echo * [A]添加右键菜单 *
Echo * [D]删除右键菜单 *
Echo * [Q]退出 *
Echo * *
Echo *=========================================================================*
Echo *注意*请右键管理员权限运行:
Set /P Choice=请选择要进行的操作 (A/D/Q) ,然后按回车:
If /I "%Choice%"=="A" Goto ADD
If /I "%Choice%"=="D" Goto DEL
If /I "%Choice%"=="Q" Exit
Goto START
:END
CLS
Echo *=========================================================================*
Echo * *
Echo * 操作完成 *
Echo * [M]返回主菜单 *
Echo * [Q]退出 *
Echo * *
Echo *=========================================================================*
Set /P Choice=       请选择要进行的操作 (M/Q) ,然后按回车:
If /I "%Choice%"=="M" Goto :START
If /I "%Choice%"=="Q" Exit
:ADD
CLS
REG ADD HKEY_CLASSES_ROOT\*\shell\SublimeText /t REG_SZ /d SublimeText /f
REG ADD HKEY_CLASSES_ROOT\*\shell\SublimeText\Command /t REG_SZ /d "%cd%\sublime_text.exe \"%%1%%\"" /f
GOTO :END
:DEL
REG DELETE HKEY_CLASSES_ROOT\*\shell\SublimeText
GOTO :END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.