Run PHP script with Windows Task Scheduler, including files fails -


i'm given windows 2012r2 machine xampp. need schedule task runs every minute. every minute php script should executed. configured correctly, i'm using .bat file action in task scheduler.

the problem when test .bat file, works charm (execute .bat file folder it's in). when task scheduler executes .bat file fails. script unable include files php script calls. i'm guessing that's because task scheduler doesn't execute script directory php script in. cronjobbase.php has line includes myincludes.php (examplary, in real life bootstrap file included)

this .bat content (there's no difference in using or leaving quotes cd command):

cd "d:\xampp\htdocs\myapp\app\cronjobs\" "d:\xampp\php\php.exe" -f cronjobbase.php mycronjob 

i'm trying cd cronjobs folder execute cronjobbase.php argv[1] mycronjob (which should include mycronjob.php cronjobbase.php). tells me cronjobbase.php not found. i'm guessing cd-ing cronjobs folder fails.

when try "d:\xampp\php\php.exe" -f d:\xampp\htdocs\myapp\app\cronjobs\cronjobbase.php mycronjob .bat content inclusion of 'myincludes.php` fails , script terminates.

any suggestions on i'm doing wrong?

this should work:

cd /d "d:\xampp\htdocs\myapp\app\cronjobs\" "d:\xampp\php\php.exe" -f cronjobbase.php mycronjob 

or:

d: cd "d:\xampp\htdocs\myapp\app\cronjobs\" "d:\xampp\php\php.exe" -f cronjobbase.php mycronjob 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -