How to realize the operation of timing shutdown by DOS batch processing _dos/bat

Source: Internet
Author: User
Tags time interval

I. Interpretation of batch processing:

Batch processing (Batch), also known as a batch script. It is a batch processing of an object and is often considered a simplified scripting language for use in DOS and Windows systems. The batch file has an extension of bat.

The most common batch processing currently consists of two categories: DOS batch processing and PS batch processing. PS batch processing is based on powerful image editing software Photoshop, used to batch processing pictures of the script, while the DOS batch is based on DOS command, used to automatically batch execute DOS commands to implement a specific operation of the script.

Ii. Preparation of batch documents:

(1) Create a new text file and write a DOS command statement inside it. Then select Save As change file suffix to ". bat"

This is how to write a batch file, execute the DOS command inside the time just double-click the processing script on the line.

Three, Shoudown command and parameter introduction:

Shut down or restart the local or remote computer using the command-line tool "shutdown" in the Windows system. The command also carries a number of parameters, the following is an introduction and explanation of these parameters:

The syntax format for this command is as follows:

shutdown [-I |-l|-s |-r |-a] [f] [-M [\\ComputerName]] [-t XX] [-c ' message] [-D[P]:XX:YY]

Among them, the meaning of each parameter is:

  -iDisplays a dialog box for the graphical interface.

  -lLog off the current user, which is the default setting.

  -m ComputerNamePriority.

  -s Turn off the computer.

  -r Reboot after shutdown.

  -aAbort shutdown. The -l ComputerName system ignores other parameters except for and. During the timeout period, you can only use the -a .

  -f Forces the application to be closed to run.

  -m [\\ComputerName] Specifies the computer to shut down.

  -t xxSet the timer used for system shutdown to xx seconds. The default value is 20 seconds.

  -c "message" Specifies the message that will be displayed in the messages area in the System Shutdown window. You can use up to 127 characters. The quotation marks must contain a message.

  -d [p]:xx:yyLists the reason codes for system shutdown.

First, let's take a look at some basic uses of this command:

1. Log off the current user

shutdown - l

This command can only unregister native users and not for remote computers.

2. Shut down the local computer

shutdown - s

3. Restart the local computer

shutdown - r

4, timing shutdown

shutdown - s -t 30

Specifies that the computer automatically shuts down after 30 seconds.

5, abort the computer shutdown (cancel operation)

Sometimes we set the computer to shutdown, if for some reason and want to cancel the shutdown operation, you can use shutdown - a to stop. Such as:

shutdown -s – t 300Set the computer to shut down in 5 minutes.

Shutdown – a Cancel the shutdown operation above.

Four Write timed shutdown and cancel batch files:

(1) First, we create two new Notepad files, in which we enter the following image of the command:

One of the three hours after the shutdown of the command with the parameter 10800 is seconds (that is, 3 hours), the previous parameter introduced the time has been said, of course, you can choose other time interval;

(2) Save the two files as ". bat" as the suffix of the batch file, as shown in the following figure:

(3) After the save, it can be used, the following is the use of two pop-up message box:

The first picture is a message box that appears after you double-click a scheduled shutdown batch, and the second picture is a message box that appears when you double-click the Cancel shutdown batch

Summarize

The above is about the use of DOS batch processing to achieve the timing of the shutdown operation of all the content, I hope the content of this article for everyone's study or work can bring some help, if you have questions you can message exchange.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.