ASP.NET中调用EXE程序

using System.Diagnostics;
using System.ComponentModel;

 

public partial class _Default : System.Web.UI.Page
{
    const int ERROR_FILE_NOT_FOUND = 2;

 

    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Process proc = new Process();
        try
        {

            proc.StartInfo.FileName = @"E:\tools\GPU-Z.0.2.6.exe";
            proc.StartInfo.Arguments = "";
            proc.Start();
        }
        catch (Win32Exception ex)
        {
            if (ex.NativeErrorCode == ERROR_FILE_NOT_FOUND)
            {
                Response.Write("");
            }
           
        }

        //Process.Start("E:\\tools\\GPU-Z.0.2.6.exe");
    }
}

你可能感兴趣的:(ASP.NET)