Sublime 添加∕删除右键菜单.bat

时间:2021-12-24 14:09:48

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

 

文章来源:刘俊涛的博客

欢迎关注,有问题一起学习欢迎留言、评论