A: 

Most likely you need to specify an absolute path to your feed file. It's not clear exactly where you're executing the script from, but the script's "working directory" is generally where it was started from:

 c:\some\deeply\nested\directory> c:\php5\php.exe d:\inetpub\tools\build.php

will be trying to write the feed file in:

 c:\some\deeply\nested\directory\feed.xml

and not in c:\php5 or d:\inetpub\tools

I don't know what the task scheduler uses as its default directory, but most likely it's not what you're expecting.

Also check that the account you're running the job under in the task scheduler has write permissions on the output directory. And always check if an fopen() called succeeded (it returns FALSE on failure).

Marc B
You are correct. I just looked for feed.xml and found one in c:\users\administratorI made the assumption that the script would run in its own directory no matter how I initiated its execution. Thanks for your help