2011-11-26 101 views
1

我有一个exe,我从命令行调用。是否有可能在服务器上执行该文件?在计算机上,如果文件位于abc文件夹中,我将转到文件夹abc,然后执行批处理。汉王做我在C#下面在服务器上执行EXE

+0

该文件是否位于服务器上,您如何与它进行通信?您的问题在当前的情况下没有意义。试着更好地描述它。 –

回答

5

代码示例做到这一点,请确保您有您的权限设置正确:

System.Diagnostics.Process yourProcess = new System.Diagnostics.Process(); 

// Set the directory 
yourProcess.StartInfo.WorkingDirectory = Request.MapPath("~/"); //or wherever your file is 

// Set the filename 
yourProcess.StartInfo.FileName = Request.MapPath("bla.exe"); 

// Start the process  
yourProcess.Start(); 

ASP Net - Run Application (EXE) from ASP.Net C#

0

在一定服务器端代码,的Process.Start(MyExeFile)会做但是,只要你正在运行你的东西的用户帐户可以执行它。