: This article describes how to use bat to regularly execute php on a Windows Server. For more information about PHP tutorials, see. Use bat on Windows Server to regularly execute php
There is a similar cmd and bat file on windows and linux. bat files are similar to shell files. executing this bat file is equivalent to executing the commands in sequence (of course, you can also implement programming through logic). Therefore, we can use the bat command file to implement PHP scheduled tasks on windows servers. In fact, scheduled tasks on windows are the same as those on linux, except that the methods and approaches are different. Now let's start.
First, create a cron. bat file in a location that you think is appropriate, and then open it in a text editor (Notepad can be used). write the following content in it:
D: \ php \ php.exe-q D: \ website \ test. php
In this sentence, php.exe is used to execute the php file test. php. like the contab above, it bypasses the server environment and the execution efficiency is relatively high. Click save to close the editor.
Next, set a scheduled task to run cron. bat. Choose Start> Control Panel> task plan> add task plan. on the displayed page, set the time and password of the scheduled task, and select cron. attach bat. OK, so that a scheduled task is created. right-click the scheduled task and run it. the scheduled task starts to run. when it reaches the point, it runs cron. bat processing, cron. bat then executes php.
The above introduces the use of bat on Windows Server to regularly execute php, including some content, hope to be helpful to friends who are interested in PHP tutorials.