2014-02-28 47 views
0

我试图从localhost运行exe文件;如何从本地主机运行可执行文件

像:

string installerFilePath; installerFilePath = @"D:\MYInstaller.exe"; 
      System.Diagnostics.Process installerProcess = new System.Diagnostics.Process(); 
      installerProcess = System.Diagnostics.Process.Start(installerFilePath, "/q"); 

这里制作安装与出过沉默模式执行。使用下面的代码

:它lanchin与出运行exe文件exe文件

string installerFilePath; installerFilePath ="http://localhost/BusinessAccounting/ReportViewer/MY.exe"; 


       System.Diagnostics.Process installerProcess = new System.Diagnostics.Process(); 
       installerProcess = System.Diagnostics.Process.Start(installerFilePath, "/q"); 

可以一个expalin用了lanching如何运行exe文件...

回答

0

,您将需要创建一个ProcessStartInfo类实例,并将其属性WindowStyle设置为minimizedhidden以隐藏控制台窗口(如果这是您想要的)。

ProcessStartInfo psi = new ProcessStartInfo(<exename>, <args>); 
psi.CreateNoWindow = true; 
psi.UseShellExecute = false; 
psi.WorkingDirectory = fi.DirectoryName; 
psi.RedirectStandardOutput = true; 
psi.WindowStyle = ProcessWindowStyle.Minimized; 
相关问题