日期:2014-05-18  浏览次数:20513 次

怎样用asp.net启动本地应用程序?
比如单击页面上一个按钮,启动powerpoint,启动路径是"D:\Program Files\Microsoft Office\OFFICE11\POWERPNT.EXE"

------解决方案--------------------
用 process
------解决方案--------------------
首先要确定你是启动那里的程序?是客户端的还是服务器的。启动服务器的就用process。客户端的也可以,就是比较麻烦还有限制,我以前见过有这样的帖子,可以搜一下。
------解决方案--------------------
给你个参考
C# code

    public string ExeCommand(string commandText)
    {
        Process p = new Process();
        p.StartInfo.FileName = "cmd.exe"; //换成你要执行的
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.RedirectStandardInput = true;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.RedirectStandardError = true;
        p.StartInfo.CreateNoWindow = true;
        string strOutput = null;
        try
        {
            p.Start();
            p.StandardInput.WriteLine(commandText);
            p.StandardInput.WriteLine("exit");
            strOutput = p.StandardOutput.ReadToEnd();
            p.WaitForExit();
            p.Close();
        }
        catch (Exception e)
        {
            strOutput = e.Message;
        }
        return strOutput;
    }

------解决方案--------------------
楼主要求的是本地的。
我建议楼主用SHELL命令,用JS去执行。(需要安全授权)我以前做过。

------解决方案--------------------
同意楼上