Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Uno script che ti permette di disabilitare / abilitare facilmente le voci per arrestare il sistema, riavviarlo, disconnettere l'utente corrente. Vedi https://gioxx.org/tag/StartOptionDisable
@echo off
:: Windows 10 Start Options Disable
:: https://gioxx.org/tag/StartOptionDisable
:: GSolone 2021 (ult.mod. 15112021-rev5)
:: Check Windows Version
for /f "tokens=4,5,6 delims=[]. " %%G in ('ver') Do (set _major=%%G& set _minor=%%H& set _build=%%I)
if '%_major%' NEQ '10' (
echo Windows 10 non rilevato, premi un tasto per terminare lo script.
pause > NUL
goto END
) else (
echo Windows 10 rilevato.
echo Major Version: [%_major%]
echo Minor Version: [%_minor%]
echo Build: [%_build%]
if %_build% LEQ 17134 (
echo La versione minima di compatibilità con lo script è Windows 10 1809.
echo Rilevata versione inferiore, premi un tasto per terminare lo script.
pause > NUL
goto END
)
)
:: BatchGotAdmin
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo Richiedo utente amministratore ...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params = %*:"=""
echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:: Menu Deactivator
:gotAdmin
cls
echo Microsoft Windows 10 (1809+) Options Deactivator
echo.
:menu
echo 1 - Hide/Restore Shutdown.
echo 2 - Hide/Restore Reboot.
echo 3 - Hide/Restore SignOut.
echo.
echo 4 - Exit from batch.
echo.
choice /C 1234 /M "Desired option:"
if errorlevel 4 goto END
if errorlevel 3 goto SignOut
if errorlevel 2 goto Reboot
if errorlevel 1 goto Shutdown
:Shutdown
echo.
echo Option Selected: Hide/Restore Shutdown
reg query "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideShutDown" /v value | find "0x0"
if %errorlevel% == 0 (
echo Hide Shutdown
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideShutDown" /V value /T REG_DWORD /D 1 /F
) else (
echo Show Shutdown
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideShutDown" /V value /T REG_DWORD /D 0 /F
)
echo.
goto menu
:Reboot
echo.
echo Option Selected: Hide/Restore Reboot
reg query "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideRestart" /v value | find "0x0"
if %errorlevel% == 0 (
echo Hide Reboot
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideRestart" /V value /T REG_DWORD /D 1 /F
) else (
echo Show Reboot
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideRestart" /V value /T REG_DWORD /D 0 /F
)
echo.
goto menu
:SignOut
echo.
echo Option Selected: Hide/Restore SignOut
reg query "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideSignOut" /v value | find "0x0"
if %errorlevel% == 0 (
echo Hide SignOut
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideSignOut" /V value /T REG_DWORD /D 1 /F
) else (
echo Show SignOut
REG ADD "HKLM\SOFTWARE\Microsoft\PolicyManager\default\Start\HideSignOut" /V value /T REG_DWORD /D 0 /F
)
echo.
goto menu
:END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment