Guest User

Untitled

a guest
Oct 10th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.36 KB | None | 0 0
  1. @echo off
  2. color 0A
  3. title Conditional Shutdown.
  4.  
  5. :start
  6. echo Welcome, %USERNAME%
  7. echo What would you like to do?
  8. echo.
  9. echo 1. Shutdown in specified time
  10. echo 2. Shutdown at a specified time
  11. echo 3. Shutdown now
  12. echo 4. Restart now
  13. echo 5. Log off now
  14. echo 6. Hibernate now
  15. echo.
  16. echo 0. Quit
  17. echo.
  18.  
  19. set /p choice="Enter your choice: "
  20. if "%choice%"=="1" goto shutdown
  21. if "%choice%"=="2" goto shutdown-clock
  22. if "%choice%"=="3" shutdown.exe -s -f
  23. if "%choice%"=="4" shutdown.exe -r -f
  24. if "%choice%"=="5" shutdown.exe -l -f
  25. if "%choice%"=="6" shutdown.exe -h -f
  26. if "%choice%"=="0" exit
  27. echo Invalid choice: %choice%
  28. echo.
  29. pause
  30. cls
  31. goto start
  32.  
  33. :shutdown
  34. cls
  35. set /p sec="Minutes until shutdown: "
  36. set /a min=60*%sec%
  37. shutdown.exe -s -f -t %min%
  38. echo Shutdown initiated at %time%
  39. echo.
  40. goto cancel
  41.  
  42. :shutdown-clock
  43. echo.
  44. echo the time format is HH:MM:SS (24 hour time)
  45. echo example: 14:30:00 for 2:30 PM
  46. echo.
  47. set /p tmg=enter the time that you wish the computer to shutdown on:
  48. schtasks.exe /create /sc ONCE /tn shutdown /st %tmg% /tr "shutdown.exe -s -t 00"
  49. echo shutdown initiated at %tmg%
  50. echo.
  51.  
  52. :cancel
  53. set /p cancel="Type cancel to stop shutdown: "
  54. if not "%cancel%"=="cancel" exit
  55. shutdown.exe -a
  56. cls
  57. schtasks.exe /end /tn shutdown
  58. cls
  59. schtasks.exe /delete /tn shutdown
  60. cls
  61. echo Shutdown is cancelled.
  62. echo.
  63. pause
  64. exit
Add Comment
Please, Sign In to add comment