:: if the batch file is not run as admin, quit
net.exe session 1>NUL 2>NUL || (Echo This script requires admin elevated rights, exiting. & echo. & pause & Exit /b 1)
::find out what path the batch file is in
set batch_path=%~dp0
::crop the last character and cd into it
cd %batch_path:~0,-1%
::change drive – special way to get vairable in admin mode
echo %~d0%
%~d0%
xcopy GroupPolicy\. c:\windows\system32\GroupPolicy\ /s/e/y
pause
::pause
:: edit power plan settings
::on mains
powercfg /change monitor-timeout-ac 240
::on battery
powercfg /change monitor-timeout-dc 120
::on mains
powercfg /change standby-timeout-ac 0
::on battery
powercfg /change standby-timeout-dc 240
::——CHANGE LID SETTINGS
::https://learn.microsoft.com/en-us/windows-hardware/customize/power-settings/power-button-and-lid-settings
::https://www.elevenforum.com/t/change-power-button-action-in-windows-11.5186/
::power button
::AC on mains 3 SHUTDOWN
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
powercfg -SetActive SCHEME_CURRENT
::DC on battery 3 SHUTDOWN
powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
powercfg -SetActive SCHEME_CURRENT
::sleep button
::https://www.tenforums.com/tutorials/107766-add-remove-sleep-button-action-power-options-windows.html
::https://github.com/LinkPhoenix/Windows-10-IoT-Enterprise-Optimization/blob/master/Config%20Power%20Options%20(High%20performance).bat
::https://www.elevenforum.com/t/change-sleep-button-action-in-windows-11.5198/
::DC power battery 2 hibernate
powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 2
::AC power mains 2 hibernate
powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 96996bc0-ad50-47ec-923b-6f41874dd9eb 2
::powercfg -SetActive SCHEME_CURRENT
:: REG ADD “HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB” /v “DCSettingIndex” /t “REG_DWORD” /d “2” /f
:: REG ADD “HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB” /v “ACSettingIndex” /t “REG_DWORD” /d “2” /f
::CLOSE LID
::AC power battery 3 DO NOTHING
::powercfg -setdcvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
::powercfg -SetActive SCHEME_CURRENT
::DC power mains 3 DO NOTHING
::powercfg -setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
::powercfg -SetActive SCHEME_CURRENT
::AC on mains
powercfg /setACvalueIndex scheme_current sub_buttons lidAction 0
::DC on battery
powercfg /setDCvalueIndex scheme_current sub_buttons lidAction 0
::—- EDIT LID SETTINGS
:: TICK BOXES
::reg import “E:\admin\Fast Startup is turned off.reg”
REG ADD “HKLM\SYSTEM\ControlSet001\Control\Session Manager\Power” /v “HiberbootEnabled” /t “REG_DWORD” /d “00000000” /f
::reg import “E:\admin\Hibernate on menu.reg”
REG ADD “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FlyoutMenuSettings” /v “ShowHibernateOption” /t “REG_DWORD” /d “00000001” /f
powercfg.exe /hibernate on
pause