Windows Batch File to run PHP file

php

Solution

To execute PHP from a batch file, follow these 3 simple steps:

Add PHP to your PATH variable.

Create a batch file that calls PHP with your file:

php path\to\file.php

and name your file `whatever.bat`.

Now its just a matter of setting up a task in Windows Task Scheduler to run your batch file periodically.

Problem

I have PHP script that fetches information from a backend server and saves into a database. I am using wamp server and mysql. Now how do I make this run periodically (every 1 hour) without user interaction? I thought of using Windows Batch file. Is there any other way? How do I execute a PHP file in Windows Batch file?

Original source