C#调用C++的EXE

private void button1_Click(object sender, EventArgs e)
{
  Process process = new Process();
  //process.StartInfo.WorkingDirectory = "c:\GetName.exe";//EXE觉得路劲
  process.StartInfo.FileName = "GetName.exe";//同路劲下的EXE
  process.StartInfo.Arguments = "5";//传入的参数


  //UseShellExecute表示是否从控制台启动。如果想从标准输出流中读取输出,这个属性必需设为False

  //若要使用 StandardOutput,必须将 ProcessStartInfo.UseShellExecute 设置为 false,并且将ProcessStartInfo.RedirectStandardOutput 设置为 true

  process.StartInfo.UseShellExecute = false;


  process.StartInfo.CreateNoWindow = true;//不显示窗口
  process.Start();//启动
}

原文地址:https://www.cnblogs.com/zzhua/p/5762482.html