1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| @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
|