将Sublime Text 3 添加到鼠标右键菜单

方法一、

把以下代码,复制到SublimeText3的安装目录,然后重命名为:sublime_addright.inf,然后右击安装就可以了。PS:重命名文件之前,需要先在工具–文件夹选项,查看中,把隐藏已知文件类型的扩展名前边的复选框不勾选。

[Version]
Signature=<span class="hljs-string">"$Windows NT$"</span>
[DefaultInstall]
AddReg=SublimeText3
[SublimeText3]
hkcr,<span class="hljs-string">"*\\shell\\SublimeText3"</span>,,,<span class="hljs-string">"用 SublimeText3 打开"</span>
hkcr,<span class="hljs-string">"*\\shell\\SublimeText3\\command"</span>,,,<span class="hljs-string">""</span><span class="hljs-string">"%1%\sublime_text.exe"</span><span class="hljs-string">" "</span><span class="hljs-string">"%%1"</span><span class="hljs-string">" %%*"</span>
hkcr,<span class="hljs-string">"Directory\shell\SublimeText3"</span>,,,<span class="hljs-string">"用 SublimeText3 打开"</span>
hkcr,<span class="hljs-string">"*\\shell\\SublimeText3"</span>,<span class="hljs-string">"Icon"</span>,<span class="hljs-number">0</span>x20000,<span class="hljs-string">"%1%\sublime_text.exe, 0"</span>
hkcr,<span class="hljs-string">"Directory\shell\SublimeText3\command"</span>,,,<span class="hljs-string">""</span><span class="hljs-string">"%1%\sublime_text.exe"</span><span class="hljs-string">" "</span><span class="hljs-string">"%%1"</span><span class="hljs-string">""</span>

方法二、(推荐)可以管理添加和删除

把以下代码,复制到SublimeText3的安装目录,然后重命名为:添加∕删除右键菜单.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

最后,附一个删除右键菜单的脚本吧。把以下代码,复制到SublimeText3的安装目录,然后重命名为:sublime_delright.reg,然后双击就可以了。

Windows Registry Editor Version 5.00
<span class="hljs-special">[</span>-HKEY_CLASSES_ROOT<span class="hljs-command">\*</span><span class="hljs-command">\shell</span><span class="hljs-command">\SublimeText</span>3<span class="hljs-special">]</span>
<span class="hljs-special">[</span>-HKEY_CLASSES_ROOT<span class="hljs-command">\Directory</span><span class="hljs-command">\shell</span><span class="hljs-command">\SublimeText</span>3<span class="hljs-special">]</span>

最后附下地址:[su_button url=”https://pan.baidu.com/s/1OHoLwymK9M231AFxrgmDZg ” target=”blank”]百度网盘[/su_button] 密码: 2vp9