Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO OFF
- TITLE Sleep Timer
- :menu
- CLS
- ECHO Welcome to the sleep timer script for Windows created by The3vilM0nk3y
- ECHO -------------------------
- ECHO ^| 1 Set Sleep Timer ^|
- ECHO ^| 2 Cancel Sleep Timer ^|
- ECHO ^| 3 Close Sleep Timer ^|
- ECHO -------------------------
- SET /P selection=Enter option number:
- IF "%selection%"=="1" GOTO enterTime
- IF "%selection%"=="2" GOTO cancelShutdown
- IF "%selection%"=="3" GOTO EXIT
- ECHO That is not a valid input. Please enter 1 2 or 3.
- :cancelShutdown
- ECHO Shutdown succesfully aborted.
- timeout 3
- GOTO menu
- :enterTime
- SET /P sleeptime=Enter Sleep Time in Minutes:
- IF "%sleeptime%"=="0" GOTO tooLittle
- IF "%sleeptime%"=="" GOTO enterValue
- ECHO Setting automatic shutdown to %sleeptime% minutes.
- SET /A sleeptime *=60
- SHUTDOWN -s -f -t %sleeptime% -c "Shutdown timer has been set, use option 2 to cancel it."
- GOTO menu
- :tooLittle
- ECHO Sleep time must be greater than 0 minutes.
- pause
- GOTO enterTime
- :enterValue
- ECHO You must enter a number greater than 0. The number represents how many minutes till the computer will shutdown.
- pause
- GOTO enterTime
Advertisement
Add Comment
Please, Sign In to add comment