Implement daemon = Windows Timer task + batch processing

Source: Internet
Author: User

Cut the crap, the direct explosion.

Let's start with a little introduction to the principle.
Windows timed tasks used by the classmates know it has an option ():

The default "Settings" has a drop-down option, we can only use the default "do not start a new instance" to implement the daemon.

At the same time, timed tasks are timed, such as executing once a day, which is equivalent to checking the program once a day and not running. If it is running, and you choose "Do not start a new instance", it means that the original normal running program continues to run, and if the original program does not exist, of course, it is necessary to launch a new instance (this realizes the "guardian" function).

Here are the specific implementation steps:
(1) Create a batch file Call.bat with the following contents:

cd /d E:\solution\FuckACE\ACETest\x64\ReleaseACETest

The above batch processing simple can no longer be simple, the first sentence is to switch the DOS execution directory to the EXE file location, the second sentence is to run the executable program ACETest.exe (where the suffix is not added).
(2) Create a scheduled task
Take Win8 as an example Control Panel management Tool Task Scheduler Task Scheduler Library create a basic task name (the name of your own scheduled Task) next (default "every day" do not change, back again fine) "Next (default every day)" The next step "next" Browse (select your batch file) next finish, right-created Timed task property trigger edit Repeat task interval drop-down select "5 minutes" (select "5 minutes" can also be manually changed to "1 minutes" and so on) "OK" OK "right button" operation. Ok

Note: If there are two batches to guard this exe at the same time, then two EXE will be created, just a reminder. That means you don't have to create multiple scheduled tasks to guard an EXE.

Part of the set:










Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Implement daemon = Windows Timer task + batch processing

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.