Batch file for Win XP auto shutdown

  

There are a lot of shutdown programs on the network. Today, we use DIY, which is easy to use batch processing. The principle is super simple. After reading it, do your own timed shutdown program.

There have been a lot of movies recently, and I am too lazy to go to the cinema alone. I will download it online and watch it when I am fine at night. Going to work during the day, driving a computer to download movies, setting the time with the automatic shutdown program, and when the movie is almost downloaded, it will automatically shut down. A lot of online timed shutdown procedures, but I want to get a more personalized, DIY one.

Let's take a look at the principle. The shutdown of Windows XP is controlled by the Shutdown.exe program. It is located in the Windows\\System32 folder. Combine this program with the batch processing to DIY an automatic shutdown program. It is.

After knowing the relevant principles, start writing the batch:
@echo off
title System shutdown
:loop
cls
color bc
echo.< BR> echo.
Echo *** WINDOWSXP Quick Shutdown System ***
Echo.
Echo Quick Shutdown........................Please enter
Echo Start Countdown Shutdown... .........Please enter 1+Enter
Echo Set the time to shut down...............Please enter 2+Enter
Echo Display timing shutdown..................Please enter 3+Enter
echo Set daily shutdown..................Please enter 4+Enter
echo Cancel system shutdown..................Please enter space + enter
echo Exit........................ ...Please enter Q+Enter
echo.
echo.
set a=
set /pa= [Please enter]:
if "%a%"=="1" goto Aaa
if "%a%"=="2" goto bbb
i f "%a%"==" " goto ccc
if "%a%"=="" goto ddd
if "%a%"=="3" goto eee
if "%a %"=="4" goto fff
if "%a%"=="q" exit
goto loop
:ddd
@echo off
color e5
cls< BR> echo.
echo.
echo 〖The system is about to shut down and end the process〗
pause
echo.
::ntsd -cq -pn %run%
taskkill /f /t /im pfw.exe /f /t /im internat.exe /f /t /im explorer.exe
shutdown -s -f -t 0 -c "Cancel please run shutdown -a"
exit< BR> :aaa
@echo off
color f4
echo.
echo.
echo.
echo will now set the system to automatically shut down, please enter the countdown seconds here Car, the system will automatically turn off at the set time
set mytime=
set /p mytimes= [Countdown shutdown please enter the number of hours]:
set /a mytimes=%mytimes%*3600
set /p mytimef= [Please enter the number of minutes for the countdown shutdown]:
set /a mytimef=%mytimef%*60
set /p mytimem= [Countdown, please enter the number of seconds]:
set /a mytime=%mytimes%+%mytimef%+%mytimem%
shutdown -s -t %mytime% -c "Cancel please run shutdown -a"< BR> cls
echo.
echo 〖The system will shut down after %mytime% seconds
echo.
pause
goto loop
:bbb
@echo off
color f9
echo.
echo.
echo.
echo will set the system to shut down now, please enter the shutdown time (such as 12:00) here, the system will automatically close the timing < BR> set mytimes=
set mytimef=
set /p mytimes= [When timing shutdown please input]:
set /p mytimef= [Timed shutdown please enter minute]:
at %mytimes% :%mytimef% shutdown -s -t 0
::This means that the shutdown -s -t 0 operation is performed in mytime. If the current time is greater than the task execution time, the default is tomorrow, and 0 is the countdown time.
echo.
echo 〖Now all plans will be displayed〗
echo ■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■
pause
::Show plan and pause
goto loop
:ccc
@echo off
color f2
echo.
Echo.
echo.
echo 〖Now will set the system to automatically shut down〗
echo.
pause
shutdown -a
echo.
echo.
echo 〖 All plans are now displayed, the plan is canceled after the carriage return and no confirmation is required.
Echo ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■
at
echo ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ /yes
::Cancel all plans without confirmation
cls
echo.
echo 〖System has canceled automatic shutdown〗
〖The system has canceled all scheduled tasks〗
echo.
pause
goto loop
:eee
@echo off
color f4
echo.
echo.
echo.
echo will set the system to automatically shut down, please enter the countdown seconds here and press Enter, the system will automatically close at the set time
set mytime=
:: This line is to clear mytime The value of the variable, so as not to have the value of the variable in case of inattention, this is a good habit.
set mytimes=0
:: Assigning 0 is to make %mytimes% not meaningless, the same below .
set mytimef=0
set mytimem=0
set /p mytimes= [Please enter the number of hours for the countdown shutdown]:
set /a mytimes=%mytimes%*3600
set /p mytimef= [Please enter the number of minutes for the countdown shutdown]:
set /a mytimef=%mytimef%*60
set /p mytimem= [Countdown to count down, please enter the number of seconds]:
color a3
Mode con cols=30 lines=4
set /a mytime=%mytimes%+%mytimef%+%mytimem%
SET wait=ping -n 2 127.0.0.1 ^& Gt;^nul
for /l %%n in (%mytime%,-1,0) do (
rem cls
echo *************** ****
echo 〖%%n seconds after the automatic shutdown〗
echo *******************
%wait%
cls
)
shutdown -s -t 0
goto loop
:fff
@echo off
color f9
echo.
echo.
echo.< BR> echo will now set the system to run self-shutdown every day
echo.
set myopengs=
set /p myopengs= [reset settings please enter a single space + enter, single and last settings please Enter]
echo.
echo Please enter the shutdown time (such as 12:00) and press Enter, the system will close regularly
echo.
set mytimes=
set mytimef=< BR> set /p mytimes= [When timed shutdown please input]:
set /p mytimef= [Timed shutdown please enter the score]:
at %mytimes%:%mytimef% /every:M,T,W ,Th,F,S,Su shutdown -s -f
echo.
echo 〖Now all plans will be displayed〗
echo ■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■

Copy the batch and copy it to Notepad and save it as a bat file.

Copyright © Windows knowledge All Rights Reserved