|
- @ECHO off&PUSHD %~DP0 &TITLE SuperCMD 右键菜单
- >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
- )
- if "%PROCESSOR_ARCHITECTURE%"=="x86" set bits=32
- if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set bits=64
- :Menu
- SET Options=
- ECHO.&ECHO. 1.安装 SuperCMD 鼠标右键菜单
- ECHO.&ECHO. 2.卸载 SuperCMD 鼠表右键菜单
- ECHO.&ECHO. 3.退出
- ECHO.
- SET /P Options=[92m请输入选择项目序号并按回车确认:[0m
- IF /I "%Options%"=="1" GOTO install
- IF /I "%Options%"=="2" GOTO uninstall
- IF /I "%Options%"=="3" GOTO OUT
- ECHO.&ECHO.序号无效,请重新输入!
- PING -n 2 127.1>NUL
- CLS
- GOTO Menu
- :install
- Reg.exe add "HKCU\Software\Classes\exefile\shell\runasSYSTEM_TI" /ve /t REG_SZ /d "以 S&YSTEM身份运行 (TI)" /f
- Reg.exe add "HKCU\Software\Classes\exefile\shell\runasSYSTEM_TI" /v "MultiSelectModel" /t REG_SZ /d "Single" /f
- Reg.exe add "HKCU\Software\Classes\exefile\shell\runasSYSTEM_TI" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCU\Software\Classes\exefile\shell\runasSYSTEM_TI\command" /ve /t REG_SZ /d ""%~dp0SuperCMDx%bits%.exe" /TI /ShowWait /Run:"%%1" %%*" /f
- Reg.exe add "HKCU\Software\Classes\batfile\shell\runasSYSTEM_TI" /ve /t REG_SZ /d "以 S&YSTEM身份运行 (TI)" /f
- Reg.exe add "HKCU\Software\Classes\batfile\shell\runasSYSTEM_TI" /v "MultiSelectModel" /t REG_SZ /d "Single" /f
- Reg.exe add "HKCU\Software\Classes\batfile\shell\runasSYSTEM_TI" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCU\Software\Classes\batfile\shell\runasSYSTEM_TI\command" /ve /t REG_SZ /d ""%~dp0SuperCMDx%bits%.exe" /TI /ShowWait /Run:"%%1" %%*" /f
- Reg.exe add "HKCU\Software\Classes\cmdfile\shell\runasSYSTEM_TI" /ve /t REG_SZ /d "以 S&YSTEM身份运行 (TI)" /f
- Reg.exe add "HKCU\Software\Classes\cmdfile\shell\runasSYSTEM_TI" /v "MultiSelectModel" /t REG_SZ /d "Single" /f
- Reg.exe add "HKCU\Software\Classes\cmdfile\shell\runasSYSTEM_TI" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCU\Software\Classes\cmdfile\shell\runasSYSTEM_TI\command" /ve /t REG_SZ /d ""%~dp0SuperCMDx%bits%.exe" /TI /ShowWait /Run:"%%1" %%*" /f
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereSuperCMD" /ve /t REG_SZ /d "在此处打开 SuperCMD" /f
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereSuperCMD" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCR\Directory\shell\OpenCmdHereSuperCMD\command" /ve /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe /ShowWait /TI /Run:"cmd.exe" /s,/k, pushd,%%V & "cmd.exe" /s,/k, Title SuperCMD SYSTEM 权限" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereSuperCMD" /ve /t REG_SZ /d "在此处打开 SuperCMD" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereSuperCMD" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCR\Directory\Background\shell\OpenCmdHereSuperCMD\command" /ve /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe /ShowWait /TI /Run:"cmd.exe" /s,/k, pushd,%%V & "cmd.exe" /s,/k, Title SuperCMD SYSTEM 权限" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereSuperCMD" /ve /t REG_SZ /d "在此处打开 SuperCMD" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereSuperCMD" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCR\Drive\shell\OpenCmdHereSuperCMD\command" /ve /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe /ShowWait /TI /Run:"cmd.exe" /s,/k, pushd,%%V & "cmd.exe" /s,/k, Title SuperCMD SYSTEM 权限" /f
- Reg.exe add "HKCR\LibraryFolder\background\shell\OpenCmdHereSuperCMD" /ve /t REG_SZ /d "在此处打开 SuperCMD" /f
- Reg.exe add "HKCR\LibraryFolder\background\shell\OpenCmdHereSuperCMD" /v "Icon" /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe" /f
- Reg.exe add "HKCR\LibraryFolder\background\shell\OpenCmdHereSuperCMD\command" /ve /t REG_SZ /d "%~dp0SuperCMDx%bits%.exe /ShowWait /TI /Run:"cmd.exe" /s,/k, pushd,%%V & "cmd.exe" /s,/k, Title SuperCMD SYSTEM 权限" /f
- powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0SuperCMDx%bits%.exe'"
- exit
- :uninstall
- reg delete "HKCU\Software\Classes\exefile\shell\runasSYSTEM_TI" /f
- Reg.exe delete "HKCR\Directory\Background\shell\OpenCmdHereSuperCMD" /f
- Reg.exe delete "HKCR\Directory\shell\OpenCmdHereSuperCMD" /f
- Reg.exe delete "HKCR\Drive\shell\OpenCmdHereSuperCMD" /f
- Reg.exe delete "HKCR\LibraryFolder\Background\shell\OpenCmdHereSuperCMD" /f
- powershell -inputformat none -outputformat none -NonInteractive -Command "Remove-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0SuperCMDx%bits%.exe'"
- exit
- :OUT
- exit
复制代码
批处理如上~
|
|