windows - Running a php script with a .bat file -
i need run php script @ midnight every night on server. on linux system i'd set cron job, i'm stuck windows system.
i know have set task using windows task scheduler, , task need run .bat file in turn run php file, i'm stuck trying write .bat file.
what have is:
@echo off rem command runs nightly cron job start "c:\program files (x86)\php\v5.3\php.exe" -f c:\inetpub\wwwroot\sitename\crons\reminder-email.php
but when try manually run .bat file test it, windows alert saying
"windows cannot find '-f'. make sure typed name correctly, , try again.
what have missed?
the start
command optionally accepts title created window first argument; in case, thinks c:\program files (x86)\php\v5.3\php.exe
title display , -f
(the second argument) executable want run.
you can therefore fix providing placeholder title, e.g.
start "email reminder task" "c:\program files (x86)\php\v5.3\php.exe" -f c:\inetpub\wwwroot\sitename\crons\reminder-email.php
or, preferably, can ditch start
command altogether (you aren't using of unique facilities) , run php directly:
"c:\program files (x86)\php\v5.3\php.exe" -f c:\inetpub\wwwroot\sitename\crons\reminder-email.php
Comments
Post a Comment