What is the default working directory for a scheduled task in Windows 2008 R2?

Trying to figure out where the output of a long running scheduled task is being saved. Presumably, it's in the working directory of the task. Unfortunately, the "Start in" option was not set.

The scheduled task is using the "System" account.

Any ideas?


Solution 1:

The default working directory for a scheduled task running as the Local System account is

%Windir%\System32\

Source: I just tested it by making a scheduled task, running as SYSTEM, that executed a batch file. The batch file contained the line ipconfig > test123.txt. When the scheduled task is run, the test123.txt file appears in the Windows\System32 directory.

Secondly, I created another task, also running as SYSTEM, but this time the executable was set to C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe and the argument supplied was C:\Users\Ryan\Desktop\test.ps1. So basically, the scheduled task was configured to run the test.ps1 Powershell script. In the Powershell script, was the line ipconfig | Out-File .\test123.txt.

The test123.txt file once again appeared in my system32 directory when the scheduled task was run.