17

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?

Belmin Fernandez
  • 10,799
  • 27
  • 84
  • 148

3 Answers3

13

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.

Ryan Ries
  • 55,481
  • 10
  • 142
  • 199
0

The default working directory for a scheduled task in windows 10, running as the Current User account is %userprofile%\appdata\local\VirtualStore\Windows\SysWOW64.

Алдар
  • 131
  • 5
0

You can find the directory by creating a scheduled task with something like this:

Program/script: powershell.exe
Arguments: -Command "& {pwd *> C:\Users\[username]\Desktop\test.txt}"

This will start a powershell session and print the working directory to a file on your desktop.

WillNiels
  • 1
  • 1