-2

我正在开发一个基于 Web 的应用程序。我想从页面调用 .exe。我为此添加了一些代码行但是当单击按钮时,控制台窗口出现并显示一个异常,指出 - Unhanded Exception : System.NUllRefrenceException : Object reference not set to an instance of the object。

谁能帮我运行exe...

谢谢,桑杰

4

1 回答 1

0

这是一个如何做到这一点的例子:

System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo(@"c:\yourProgram.exe", @"-p customParam");
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
procStartInfo.CreateNoWindow = true;
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
string result = proc.StandardOutput.ReadToEnd();
于 2012-06-18T13:01:14.410 回答