Process.Start抛出Win32异常访问在Windows XP计算机上被拒绝

str*_*and 0 .net c# windows

我试图使用Process.Start调用可执行文件,它只在Windows XP机器上抛出Win32异常.这是安装在计算机上的控制台应用程序.

这是代码的示例:

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

using (var process = Process.Start(new ProcessStartInfo(path, content)))
       process.WaitForExit();
Run Code Online (Sandbox Code Playgroud)

这是堆栈跟踪:System.ComponentModel.Win32Exception(0x80004005):在System.Diagnostics.Process.Start(ProcessStartInfo startInfo)的System.Diagnostics.Process.Start()处的System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)中拒绝访问)

有人建议让它在Windows XP机器上运行吗?

str*_*and 7

对ProcessStartInfo使用UseShellExecute = false可以实现此功能.