Copy Code code as follows:
@ECHO off
TITLE greaterthanme-realize the function of timing shutdown, cancellation, restart and lock. Start
Cls
COLOR 1f
REM changes the console output color using the color command
MODE Con cols=41 lines=18
REM Mode statement for setting the width and height of the form
Set tm1=%time~0,2%
Set tm2=%time~3,2%
Set tm3=%time~6,2%
ECHO%date%%tm1% point%tm2% minute%tm3% seconds
ECHO =========================================
ECHO Select the action you want to make, and then press ENTER
ECHO ———————————————
ECHO.
ECHO 1. Timed shutdown
ECHO 2. Countdown shutdown
ECHO 3. To delete a scheduled shutdown task
ECHO 4. View task status
ECHO 5. Refresh Current Time
ECHO 6. Reboot
ECHO 7. Lock Computer
ECHO 8. Cancellation
ECHO 9. Exit
Echo.cho
SET choice=
SET P choice= Selection
REM Set Variable choice the character entered for the user
IF not%choice%== SET choice=%choice~0,1%
REM If the input is greater than 1 digits, take the 1th digit, such as enter 132, the return value is 1
ECHO.
IF I%choice%==1 GOTO sethour
IF I%choice%==2 GOTO outtime
IF I%choice%==3 GOTO Delat
IF I%choice%==4 GOTO View
IF I%choice%==5 GOTO start
IF I%choice%==6 GOTO Restart
IF I%choice%==7 GOTO Lock
IF I%choice%==8 GOTO logoff
IF I%choice%==9 GOTO End
REM causes a program exception to avoid the return value being empty or with spaces, plus double quotes outside the variable
REM Note that the IF statement requires a double equal number
rem If you enter a character that is not the number above, it returns a re-enter
The ECHO selection is invalid, please re-enter
ECHO.
GOTO Chosethour
Cls
ECHO.
SET ask=
Set P ask= is set to perform a shutdown command every day (yn)
IF not%ask%== SET ask=%ask~0,1%
IF I%ask%==y GOTO Yes
IF I%ask%==n GOTO No
GOTO Sethouryes
ECHO Please specify a 24-hour format for hour minutes
SET shutdowntime=
SET P shutdowntime= Input
At%shutdowntime% everym,t,w,th,f,s,su tsshutdn 0 delay0 powerdown nul
REM is set for every week from Monday to Sunday, which is the daily
IF not errorlevel 1 GOTO OK
REM Executes the OK section statement if the input is correct
ECHO%shutdowntime% is not a standard time format, please re-enter
ECHO.
GOTO Yesno
ECHO Please specify a 24-hour format for hour minutes
SET shutdowntime=
SET P shutdowntime= Input
At%shutdowntime% Tsshutdn 0 delay0 powerdown nul
IF not errorlevel 1 GOTO OK
ECHO%shutdowntime% is not a standard time format, please re-enter
ECHO.
GOTO Nook
ECHO.
SET h=%shutdowntime~1,1%
SET ah=%shutdowntime~0,1%
SET am=%shutdowntime~2,2%
SET bh=%shutdowntime~0,2%
SET bm=%shutdowntime~3,2%
IF%h%== (
SET hm=%ah% time%am% points
) ELSE (
SET hm=%bh%%bm% points)
rem If the input hmm is hm=h mm points, otherwise hm=hh mm points
IF I%ask%==y ECHO system will be closed every day%hm%
IF I%ask%==n ECHO system will be closed at%hm%
ECHO Set, complete! Press any key to continue ...
PAUSE nul
GOTO Startouttime
Cls
ECHO.
ECHO, enter the number of seconds to Countdown.
ECHO ————————
ECHO (after setting to cancel, click OK and press CTRL + C key two times)
SET timed=
SET P timed= Input
Tsshutdn%timed% delay0 Powerdown nul
IF not errorlevel 1 GOTO OK
ECHO%timed% is an invalid shutdown time, please re-enter
ECHO.
GOTO Outtimedelat
Cls
Echo.
At Del y
Echo timed Shutdown task canceled, press any key to continue ...
Pause nul
GOTO Startview
MODE Con cols=85 lines=18
COLOR 70
ECHO.
At
ECHO Press any key to continue ...
PAUSE nul
GOTO Startrestart
Shutdown-r-T 0lock
rundll32.exe user32.dll,lockworkstation
Goto Startlogoff
Logoffend
Exit