How to run a PHP file in a scheduled task (Windows Task Scheduler)
The Run command should be
C:\Path\to\php.exe -f "C:\Path\to\file.php"
From the command line help of php.exe:
-f Parse and execute <file>.
I just wrote a .bat
file that does the work file.bat
@ECHO OFFphp.exe -f "C:\code\cust.php"
And put it in the Schedule Tasks like this:
Run: C:\code\file.bat
Start in: C:\code\
If you running php scripts, in most of cases script awaiting to be runned in current folder.That mean you must set up folder each your action, use field "Start In".
Example:
Run: C:\php\php.exe Arguments: -f C:\web\myscript.php
Do not forget:
Start in: C:\web\