How to Set a scheduled task to execute a PHP file in WINDOWS

Source: Internet
Author: User

1. Write a PHP program named test. php. The content is as follows:
Copy codeThe Code is as follows:
<?
$ Fp = fopen ("test.txt", "a + ");
Fwrite ($ fp, date ("Y-m-d H: I: s"). "success! \ N ");
Fclose ($ fp );
?>

The program writes it boldly. It's okay to use include \ require.
2. Create a Bat file named test. bat. The content is as follows:
Copy codeThe Code is as follows:
D: \ php \ php.exe-q D: \ website \ test. php
// Change the Directory

3. Create a WINDOWS scheduled task:
Start> Control Panel> Task Scheduler> Add Task Scheduler
Browse the folder and select the above bat file
Set the time and password (for WINDOWS login)
Save it.
4. over! Right-click the scheduled task and click "run ".

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.