1. 下载sublimeText3: https://pan.baidu.com/s/1LIGorFcl49Rnu5MnV1SMQw 提取码: b0km , 安装
2. 第一种方法:
新建sublime.bat , 放进安装目录, 写入代码:
@ECHO OFF & PUSHD %~DP0 & TITLE
>NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
"%TEMP%\Getadmin.vbs"
DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
Exit /b
)
SET /P ST=输入a添加右键菜单,输入d删除右键菜单:
if /I "%ST%"=="a" goto Add
if /I "%ST%"=="d" goto Remove
:Add
reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /t REG_SZ /v "" /d "用 &Sublime Text 打开" /f
reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /t REG_EXPAND_SZ /v "Icon" /d "%~dp0sublime_text.exe" /f
reg add "HKEY_CLASSES_ROOT\*\shell\Sublime Text\command" /t REG_SZ /v "" /d "%~dp0sublime_text.exe \"%%1\"" /f
exit
:Remove
reg delete "HKEY_CLASSES_ROOT\*\shell\Sublime Text" /f
exit
3. Windows电脑第二种方法:
a. " win " + " r " 快捷键调出运行, 输入 " regedit " 进入注册表编辑器, 如图
b. 依次打开 " HKEY_CLASSES_ROOT " -> " * " -> " shell ", 点击 "shell" ,右键 "新建" -> "项" -> 输入名称, 如 "sublime text" ,
c. 设置图标:
选择 "sublime text" , 在右侧空白处右键, 点击"新建" -> "字符串值(s)", 输入"icon",
点击"icon" , 在 "数值数据(v)" 中输入安装位置, 如 "D:\Sublime Text 3\sublime_text.exe"
d. 设置名称;
点击 "shell" -> "新建" -> "项", 输入"command", 右侧双击"默认", 在 "数值数据(v)" 中输入位置, 如 " D:\Sublime Text 3\sublime_text.exe "%1 ", 如图:
e. 选中文件右键即可看到用 "sublime text " 打开
代码来源: https://www.cnblogs.com/lovebing/p/11098306.html