Jorre
Jorre

Reputation: 17581

Console application not starting processes when scheduled in Windows

I have a simple .NET console app in C#, that runs an external process "pscp" (putty secure copy). This works great when I just run the .exe.

However, when I schedule the application in windows scheduled tasks, the application does not seem to open the external process pscp.exe. Normally it should pop up an extra console screen and open pscp.exe there. This works, just not when scheduled.

I start the process like this:

pscp.FileName = "pscp.exe";
Process p = Process.Start(pscp);
p.WaitForExit();

Any ideas on how to fix this?

Upvotes: 0

Views: 2589

Answers (2)

maxi3601
maxi3601

Reputation: 96

Starting cmd with the /c argument runs "your exe" in a new cmd window.

Upvotes: 1

Adam Dymitruk
Adam Dymitruk

Reputation: 129526

The scheduled task runs under a different identity. Make sure that's working. Also, make sure you wrap the call to your exe with a cmd /c "your exe".

Upvotes: 0

Related Questions