c# - 在服务器上执行一个 EXE

标签 c# asp.net exe

我有一个从命令行调用的 exe。是否可以在服务器上执行该文件?在计算机上,如果文件位于文件夹 abc 中,我将转到文件夹 abc,然后执行批处理。我如何在 C# 中执行此操作

最佳答案

下面的代码示例,请确保您的权限设置正确:

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#

关于c# - 在服务器上执行一个 EXE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8282454/

相关文章:

powershell - Powershell脚本无法识别我的功能

C# 字典层次结构到 xml 字符串?

c# - 为什么.NET Framework 中存在两个相同的接口(interface)?

c# - DataTable 到 List<T> 的转换

c# - asp.net:如何检测 iOS/Android?

c# - 如何摆脱 "No value given for one or more required parameters"

JavaFX 单实例应用程序

java - 我的 Java 软件可以转换为 .exe 软件吗?

c# - IIS 工作进程 : Which DLLs are loaded when different sites reference different versions?

c# - asp.net c# 中的正则表达式