1
votes

I'm attempting to call an executable using Process.Start and it is throwing a Win32 Exception only on Windows XP machines. This is a console application installed on the machine.

Here's an example of the code:

var path = @"C:\mycoolpath\file.exe";
var content = "My cool content";

using (var process = Process.Start(new ProcessStartInfo(path, content)))
       process.WaitForExit();

Here's the stack trace:

System.ComponentModel.Win32Exception (0x80004005): Access is denied
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)

Does anyone have any advice on getting this to work on Windows XP machines?

1
Totally wild guess, but perhaps you should grant it access so it will no longer be denied access?user541686
Is this an ASP.NET app or a Win32 service?Stephen Cleary
What kind of application it is form where you are calling this code? Is it a windows service?ukhardy
Under which user it is failing? Do you run under admin or user account? "throwing a Win32 Exception only on Windows XP machines" - does it mean that under ie. WinServer, Win7 it is running properly?Tomas Voracek

1 Answers

9
votes

Using UseShellExecute = false for the ProcessStartInfo lets this work.