Scheduled run of PHP file instance with cmd command line in windows

Source: Internet
Author: User

Next let's take a look at a windows scheduled cmd command line to run the PHP file instance. Here we mainly use the windows scheduled task function.

In Windows, you can use php.exe to execute the PHP file, and then write the command to bat for scheduled execution, which is much more reliable than the browser's timed refresh.

The path of php.exe and the path of the PHP file to be executed (the Code is as follows ):

D: \ Program Files \ wamp \ bin \ php \ php5.4.6 \ php.exe D: \ Program Files \ wamp \ www \ phpinfo. php

Save it as a bat file and you can use windows to schedule tasks. You can use the-h parameter to check whether php.exe is running.

> On the windows Server, use the built-in task plan in combination with bat or use a specific browser to regularly execute php or refresh

Method 1:


Task Plan and bat cooperation
1. Add a scheduled task or write a script in the background of zhimeng.
2. Create a text document, enter the bat script command, and modify the txt extension to bat.
The content format is as follows:

@ Echo off

Rem disable echo

Start C: \ "Program Files" \ "Internet Explorer" \ ipolice.exe http://www.skyhome.cn

Rem uses a browser to open the url http://www.bKjia. c0m

Ping 127.1-n 10> nul
Taskkill/im chrome.exe/f

Rem 10 seconds (the unit is seconds later). Execute the chrome.exe process to close the browser (chrome is used by default)

3. Run the bat script regularly according to the required rules using the winows scheduler tool.

 

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.