Jul 12, 2022

Windows: One click Hibernate, Shudown & Lock batch files

One click hibernate, lock & shutdown batch files:
Hibernate.bat (You need to enable hibernation on windows)

@echo off
setlocal
:PROMPT
SET /P AREYOUSURE=Are you sure (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END

echo Hibernating...
cd c:\
shutdown /h /t 0 /c "immediate hibernate"

:END
endlocal

Lock.bat

@echo off
setlocal
Rundll32.exe user32.dll,LockWorkStation

:END
endlocal

Shutdown.bat (read more)

@echo off
setlocal
:PROMPT
SET /P AREYOUSURE=Are you sure (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END

echo Turning off...
cd c:\
shutdown /s /t 0

:END
endlocal