Specifying the running directory for Scheduled Tasks using schtasks.exe Specifying the running directory for Scheduled Tasks using schtasks.exe windows windows

Specifying the running directory for Scheduled Tasks using schtasks.exe


Just wanted to add details that are valid for Windows Server 2008 and 2012. As many people can understand screen shots better here is a screen shot:
enter image description here

To sum it up. When you create the action for your scheduled task you have the option to set the "Start in (optional)" field (rounded in red on the screen shot). This will be the directory from where your process is triggered.

Hope this helps!


I recently came across the same issue. The way I resolved it was to add the /V1 switch to the schtasks command.

/V1 creates a pre-vista compatible scheduled task and automatically populates the Start In directory.


You can set the start in directory using the following command

The key is the \ in the /tr switch.

SCHTASKS /Create /u username /p pswd /ru "NT AUTHORITY\SYSTEM"  /rp /sc ONSTART /tn task-name /tr "\"D:\name-of-file-to-run\" "