开发者

Process.Start throws Win32 Exception Access is Denied on Windows XP Machines

开发者 https://www.devze.com 2023-02-13 05:31 出处:网络
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.

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.P开发者_如何学Pythonrocess.Start(ProcessStartInfo startInfo)

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


Using UseShellExecute = false for the ProcessStartInfo lets this work.

0

精彩评论

暂无评论...
验证码 换一张
取 消