Why is "start in" needed for Windows scheduled tasks?

Posted by GomoX on Server Fault See other posts from Server Fault or by GomoX
Published on 2012-09-11T21:37:24Z Indexed on 2012/09/11 21:39 UTC
Read the original article Hit count: 180

Filed under:
|

We develop a web application that can be deployed on Windows or Linux. The Linux implementation uses cron, and the Windows one uses scheduled tasks to run a single PHP script that processes all scheduled tasks for our system.

The task is scheduled using schtasks during the install process, like:

This has always worked both under W2003 and W2008. A week ago a customer reported that scheduled tasks were not running. He is running on Windows 2008. We checked over and over and finally solved the issue by entering the folder that contains the .vbs script as the "start in" folder for the scheduled task.

This said, there is no way to set up the "start in..." value from schtasks without using an XML definition of the tasks. XML definitions don't work in Windows 2003, so I would have to add windows version detection to the installer, additional testing, etc (I'd like to avoid this if at all possible).

The only atypical thing I noticed about the install is that the system is installed in D:\ as opposed to the default C:\Program Files (x86)\, but I don't see how this would matter. All the paths are absolute in all the scripts.

Can anyone suggest a reasonable solution for this?

© Server Fault or respective owner

Related posts about Windows

Related posts about scheduled-task