Originally Posted by Fou-Lu
What's the $retval giving you back? I'd assume that schtasks would return 0 on success.
The entire purpose has me a bit confused though. You schedule to run once notepad and launch a file, which you then write to with the information about the task. That seems a bit pointless IMO.
The $out should contain the output of the call, which is nothing (erm, I think its nothing). When you've redirected the output to the file, the stdout won't have anything in it to present back to PHP. So that cannot be used to determine if it was successful.
0-byte file would say either it doesn't find the task, or that there is no permissions to write. In either case I would actually expect that the $out would contain that, but its possible that you may need to redirect the stderr to the stdout as well.
Windows web servers are such a nightmare to work with :/
I apologize, I copied & pasted the wrong line for the $fname. It's supposed to be repost_labor.bat, not repost_labor.txt. I corrected it above. It should've been:
$fname = 'd:\scripts\labor\scheduled\repost_labor.bat';
This is how $out looks:
$out => Array (0)
and $retval has a value of:
When I run the .bat file from the command line it works.