Sublime Add / Remove context menu .bat

Sublime Add / Remove context menu .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 = input a add context menu, input d Delete context menu:

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

 

Source: Liu Juntao's blog

Welcome attention, there is a problem learning welcoming message, comment

Guess you like

Origin www.cnblogs.com/lovebing/p/11098306.html