Silverlight调用应用程序

代码
//调用可执行文件的方法
  public void CallSteven()
  {
  
string strCmd = "";
  DateTime dt 
= DateTime.Now;
    
  
//注意:需要引入System.Diagnostics;
  Process prc = new Process();
    

  
try
  {
  
//指定调用的可执行文件
  
//strCmd += @"E:\Documents and Settings\Administrator\桌面\中国近代史.exe ";

  
//如果可执行文件需要接收参数就加下下面这句,不同参数之间用空格隔开
  
//strCmd += 参数1 + " " + 参数2 + " " + 参数n;

  
//调用cmd.exe在命令提示符下执行可执行文件
  prc.StartInfo.FileName = Server.MapPath("中国近代史.exe");
  
//prc.StartInfo.Arguments = " /c " + strCmd;
  prc.StartInfo.UseShellExecute = false;
  prc.StartInfo.RedirectStandardError 
= true;
  prc.StartInfo.RedirectStandardOutput 
= true;
  prc.StartInfo.RedirectStandardInput 
= true;
  prc.StartInfo.CreateNoWindow 
= false;

  prc.Start();

  }
  
catch (Exception exU)
  {
  
if (!prc.HasExited)
  {
  prc.Close();
  }

  
throw new Exception(exU.Message.ToString());
  }
  }
原文地址:https://www.cnblogs.com/554006164/p/1705177.html