fdhsdrdark
fdhsdrdark

Reputation: 164

Windows Server Task Scheduler needs files to be in System32 folder?

I have made a C# console application which needs 2 config files for booting. When I run it from cmd window it runs fine-finds the 2 config files(which are placed within the exe produced directory).

However,when using the Windows server task scheduler i get an excpetion - " Could not find file 'C:\Windows\system32\field.config' "

I tried to use a bat file for the task but same issue occurs-task scheduler tries to find the files in System32 direcory.

Placing the two config files within System32 direcory is a workaround but is there any other way? Googled for similar issues but no information at all. Any help is mutch appriciated.

Upvotes: 5

Views: 7125

Answers (2)

John
John

Reputation: 191

I know this is old but figured I'd put my finding here incase anyone stumbles on this.

On Properties>Action, it seems to be the "Start in (optional)" field on the action edit screen where you type the directory you want the working directory to be located.

Upvotes: 19

K-ballo
K-ballo

Reputation: 81399

With no actual code to look at, let me make an educated guess. Within your application, you are trying to open those files with paths relative to the executable (say: field.config). When you set the scheduled task, you are not properly configuring the working directory; then the application is executed with System32 as the working directory and that's why it looks for the files there.

Upvotes: 1

Related Questions