我想在C#asp.net(mvc)中运行exe文件

问题描述:

我想在C#asp.net(mvc)中运行.exe文件。我能够运行该特定的.exe文件,但它的文件需要在我的电脑目录中的其他文件。我想在C#asp.net(mvc)中运行exe文件

如何将该目录添加到我的项目中? This is my running project. The exe file can't find the files which the .exe files needs to execute.

以下是我可以从我的电脑运行.exe文件的代码。

public string Onclick() 
    { 

     Process p = new Process(); 
     p.StartInfo.FileName = @"C:\Users\Talha\Desktop\New folder\linkedin\server"; 
     p.Start(); 
     // ProcessInfo.Start(@"C:\Users\Talha\Desktop\New folder\linkedin\server.exe"); 
     return "BUTTON ONCLICK"; 
    } 
+0

塔尔哈,哪里是你的 “links1.txt” 文件在什么位置?它是否包含在可执行文件所在的文件夹中? –

+0

你是否期待这个MVC网站在客户端上运行可执行文件? – Crowcoder

+0

@Shai Aharoni “links1.txt”文件位于“C:\ Users \ Talha \ Desktop \ New folder \ linkedin”其中存在我的exe文件(server.exe)。是的,它包含在可执行文件所在的文件夹中。 –

你应该写这个地址:

"C:\Users\Talha\Desktop\New%20folder\linkedin\server.exe"