GISTS/windows/win11-new-mouse-menu.bat

64 lignes
2,1 Kio
Batchfile
Brut Lien permanent Vue normale Historique

2024-05-02 00:13:10 +02:00
@echo off
:: First, we escalate privileges of the terminal
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getPrivileges
if '%1'=='ELEV' (echo ELEV & shift /1 & goto gotPrivileges)
echo.
echo Invoking UAC for Privilege Escalation
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
echo args = "ELEV " >> "%temp%\OEgetPrivileges.vbs"
echo For Each strArg in WScript.Arguments >> "%temp%\OEgetPrivileges.vbs"
echo args = args ^& strArg ^& " " >> "%temp%\OEgetPrivileges.vbs"
echo Next >> "%temp%\OEgetPrivileges.vbs"
echo UAC.ShellExecute "!batchPath!", args, "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%SystemRoot%\System32\WScript.exe" "%temp%\OEgetPrivileges.vbs" %*
exit /B
:gotPrivileges
if '%1'=='ELEV' shift /1
echo Windows 11 : Control context menu and explorer command bar
echo Restart explorer shell to take effect.
:start
:: check current configuration
reg query "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /ve >nul 2>nul
set newmenu=%errorlevel%
reg query "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" /ve >nul 2>nul
set combar=%errorlevel%
echo.
if %newmenu%==0 echo (1) Deactivate new right click menu
if %newmenu%==1 echo (1) Restore new right click menu
if %combar%==0 echo (2) Deactivate explorer command bar
if %combar%==1 echo (2) Restore explorer command bar
echo.
choice /n /c:12 /m "Choose your command (1 or 2)"
if errorlevel ==2 goto changebar
if errorlevel ==1 goto changemenu
goto start
:changemenu
cls
if %newmenu%==0 (
reg delete "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}" /f
echo.
goto start
)
reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve
echo.
goto start
:changebar
cls
if %combar%==0 (
reg delete "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}" /f
echo.
goto start
)
reg add "HKCU\Software\Classes\CLSID\{d93ed569-3b3e-4bff-8355-3c44f6a52bb5}\InprocServer32" /f /ve
echo.
goto start