如何在项目的虚拟路径中运行EXE文件 [英] How to run EXE file in virtual path of the project

查看:124
本文介绍了如何在项目的虚拟路径中运行EXE文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MVC项目中,我需要运行控制台exe文件。所以我将它们全部添加到我的项目中的单独文件夹中。当我尝试使用process.start()访问该exe文件时。文件没有得到识别。我使用server.mappath(〜/ Foldername /)访问该文件。



请帮帮我......



有问候,

Srinivas。

In my MVC project I need to run console exe files. So I added all of them to my project in a seperate folder. When I am trying to access that exe file using process.start(). File is not getting identifying. I am accessing that file by using server.mappath("~/Foldername/").

Please Help me...

With Regards,
Srinivas.

推荐答案

process.start只在我给出完整路径时才会发生exe文件。如果我指定exe文件文件的相对路径未找到异常则抛出...



这是我的代码片段



process.start is happening only when i am giving full path of exe file. If I am specifying relative path of the exe file file not found exception it is throwing...

Here is my code snippet

string filePath = Server.MapPath(@"/../Schedulers/" + fileName)
if (System.IO.File.Exists(filePath))
{
    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath, "");
    System.Diagnostics.Process p =
    System.Diagnostics.Process.Start(info);
    p.Start();
}


这篇关于如何在项目的虚拟路径中运行EXE文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆