Scheduling PHP script with arguments with Schtasks
Just like the title says here is a sample of the command that I'm trying to execute in windows command line:
Schtasks /create /tn "demo1" /tr "C:\xampp\php\php.exe \"c:\xampp\htdocs\testrunner\php\scheme_executor.php arg1\"" /ru Administrator /rp Pa55word! /sc once /st 08:56:00
I get a 'SUCCESS' response and I can see the task is scheduled, but when it runs I don't think php is able to locate the script file because the arg1 isn't being parsed from the file path/name. 开发者_如何学JAVA The task is removed from windows' Scheduled Tasks.
I got it sorted - I needed to remove the \"'s from the /tr ie:
Schtasks /create /tn "demo1" /tr "C:\xampp\php\php.exe c:\xampp\htdocs\testrunner\php\scheme_executor.php arg1" /ru Administrator /rp Pa55word! /sc once /st 08:56:00
精彩评论