I wrote C# console app that at some point tries to unzip a file using 7zip (specifically 7za.exe). When I run it manually everything runs fine, but I if I setup a task in Task Scheduler and have it run it throws this exception:
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
Here's my code:
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = "7za.exe"; //http://www.dotnetperls.com/7-zip-examples
p.Arguments = "x " + zipPath + " -y -o" + unzippedPath;
p.WindowStyle = ProcessWindowStyle.Hidden;
Process x = Process.Start(p);
x.WaitForExit();
7za.exe is part of my project, with Copy to Output Directory = Copy Always. The task is setup with my account, and I checked off Run with Highest Privileges.
7za.exeon the path. Or, the working directory is not what you expect. Specifying the full path might be a good move. No idea why you want to run with high privileges. Why did you do that, or was that just random trial and error? - David Heffernan