In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "batch processing how to achieve timing shutdown, logout, restart, locking and other functions", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "batch processing how to achieve timing shutdown, logout, restart, locking and other functions" of this article.
The code is as follows:
@ ECHO off
TITLE greaterthanme- realizes the functions of timing shutdown, logout, restart, locking and so on. Start
CLS
COLOR 1f
Rem uses the COLOR command to change the console output color
MODE con COLS=41 LINES=18
The rem MODE statement sets 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% points tm2% minutes tm3% seconds
ECHO = =
ECHO, please select the operation you want to perform, and then press enter
ECHO-
ECHO.
ECHO 1. Timing shutdown
ECHO 2. Countdown to shutdown
ECHO 3. Delete scheduled shutdown task
ECHO 4. View task status
ECHO 5. Refresh the current time
ECHO 6. Restart
ECHO 7. Lock the computer
ECHO 8. Write off
ECHO 9. Quit
ECHO.cho
SET Choice=
SET P Choice= selection
Rem sets the variable Choice to the character entered by the user
IF NOT Choice%== SET Choice=%Choice~0,1%
Rem if the input is greater than 1 bit, take the first bit, for example, enter 132, then 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
In order to avoid program exceptions caused by empty return values or spaces in rem, it is necessary to put double quotation marks around the variables.
Rem note that the IF statement requires a double equals sign
Rem if the character entered is not the above number, it will be returned to re-enter
Invalid ECHO selection, please re-enter
ECHO.
GOTO choSetHour
CLS
ECHO.
SET ask=
Is SET p ask= set to execute the 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
Please specify the 24-hour standard time for ECHO. The format is hours and minutes.
SET shutdowntime=
SET p shutdowntime= input
At shutdowntime% everyM,T,W,Th,F,S,Su tsshutdn 0 delay0 powerdown nul
Rem is set every week from Monday to Sunday, that is, every day
IF NOT errorlevel 1 GOTO ok
Rem executes the statement of the ok section if it is entered correctly
ECHO shutdowntime% is not a standard time format, please re-enter it
ECHO.
GOTO yesno
Please specify the 24-hour standard time for ECHO. The format is hours and 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 it
ECHO.
GOTO nook
ECHO.
SET hashes% shutdowntimepieces 1%
SET ah=%shutdowntime~0,1%
SET am=%shutdowntime~2,2%
SET bh=%shutdowntime~0,2%
SET bm=%shutdowntime~3,2%
IF% h% ratio = (
% am% points at SET HM=%ah%
) ELSE (
% bm% points at SET HM=%bh%)
Rem if you enter hmm, then mm points for HM=h, otherwise mm points for HM=hh
IF I% ask%==y ECHO system will be shut down at% HM% every day
IF I ask%==n ECHO system will be shut down at HM%
ECHO is set! Press any key to continue.
PAUSE nul
GOTO startouttime
CLS
ECHO.
ECHO, please enter the countdown seconds
ECHO-
ECHO (to cancel after setting, click OK and press Ctrl+C twice)
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 scheduled shutdown task has been cancelled, 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
These are all the contents of this article entitled "how to achieve scheduled shutdown, logout, restart, locking and other functions in batch processing". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.