Use bat to regularly execute php on Windows servers
There is a similar cmd and bat file on Windows and Linux. The bat file is similar to a shell file. Executing this bat file is equivalent to executing the commands inside in sequence (of course, you can also Programming is implemented through logic), so we can use the bat command file to implement PHP scheduled tasks on the windows server. In fact, the principle of scheduled tasks on Windows is the same as that on Linux, but the methods and approaches are different. Okay, let’s get started.
First, create a cron.bat file in a location that you think is more appropriate, then open it with a text editor (Notepad will work), and write the following content in it:
<code>D:\php\php.exe -q D:\website\test.php </code>
This sentence means , use php.exe to execute the php file test.php. Like the contab above, it bypasses the server environment and the execution efficiency is relatively high. After writing, click Save and close the editor.
The next step is to set up a scheduled task to run cron.bat. Open in sequence: "Start -> Control Panel -> Task Schedule -> Add Task Schedule", set the time and password of the scheduled task in the opened interface, and mount cron.bat by selecting it. OK, such a scheduled task has been created. Right-click on the scheduled task, run, and the scheduled task will start executing. When the time is up, cron.bat will be run for processing, and cron.bat will execute php.
The above introduces the use of bat to execute PHP regularly on Windows servers, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.