- @echo off
- color 0A
- title Conditional Shutdown.
- :MAIN
- cls
- ECHO.
- ECHO ...............................................
- ECHO PRESS 1, 2 OR 3 to select your task, or 4 to EXIT.
- ECHO ...............................................
- ECHO.
- ECHO 1 - Open Notepad
- ECHO 2 - Open Calculator
- ECHO 3 - Open Notepad AND Calculator
- ECHO 4 - EXIT
- ECHO.
- ECHO.0 GOTO NEXT MENU
- echo.
- SET /P M=Type 1, 2, 3, 4 or 0 then press ENTER :
- IF %M%==1 GOTO NOTE
- IF %M%==2 GOTO CALC
- IF %M%==3 GOTO BOTH
- IF %M%==4 GOTO EOF
- IF %M%==0 GOTO start
- :NOTE
- cd %windir%\system32\notepad.exe
- start notepad.exe
- GOTO MAIN
- :CALC
- cd %windir%\system32\calc.exe
- start calc.exe
- GOTO MAIN
- :BOTH
- cd %windir%\system32\notepad.exe
- start notepad.exe
- cd %windir%\system32\calc.exe
- start calc.exe
- GOTO MAIN
- :start
- cls
- echo Welcome, %USERNAME%
- echo What would you like to do?
- echo.
- echo 1. Shutdown in specified time
- echo 2. Shutdown at a specified time
- echo 3. Shutdown now
- echo 4. Restart now
- echo 5. Log off now
- echo 6. Hibernate now
- echo.
- echo 0. Quit
- echo.
- echo 9 GOTO MAIN MENU
- set /p choice="Enter your choice: "
- if "%choice%"=="1" goto shutdown
- if "%choice%"=="2" goto shutdown-clock
- if "%choice%"=="3" shutdown.exe -s -f
- if "%choice%"=="4" shutdown.exe -r -f
- if "%choice%"=="5" shutdown.exe -l -f
- if "%choice%"=="6" shutdown.exe -h -f
- if "%choice%"=="0" exit
- if "%choice%"=="9" goto MAIN
- echo Invalid choice: %choice%
- echo.
- pause
- cls
- goto start
- :shutdown
- cls
- set /p min="Minutes until shutdown: "
- set /a sec=60*%min%
- shutdown.exe -s -f -t %sec%
- echo Shutdown initiated at %time%
- echo.
- goto cancel
- :shutdown-clock
- echo.
- echo the time format is HH:MM:SS (24 hour time)
- echo example: 14:30:00 for 2:30 PM
- echo.
- set /p tmg=enter the time that you wish the computer to shutdown on:
- schtasks.exe /create /sc ONCE /tn shutdown /st %tmg% /tr "shutdown.exe -s -t 00"
- echo shutdown initiated at %tmg%
- echo.
- :cancel
- set /p cancel="Type cancel to stop shutdown: "
- if not "%cancel%"=="cancel" exit
- shutdown.exe -a
- cls
- schtasks.exe /end /tn shutdown
- cls
- schtasks.exe /delete /tn shutdown
- cls
- echo Shutdown is cancelled.
- echo.
- pause
- exit
Raw Paste