繁体   English   中英

ASP.NET Error System.ComponentModel.Win32Exception:'系统找不到指定的文件'

[英]ASP.NET Error System.ComponentModel.Win32Exception: 'The system cannot find the file specified'

我到处寻找这个答案。 这是在调试期间单击网页上的button1时。 我尝试了几个目录,都没有运气。 有什么建议么。 我绝对肯定这不是路径名称的问题。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Diagnostics;

public partial class Simulators : System.Web.UI.Page
{ 


    private System.Diagnostics.Process myBatProcess;

    //private void Form1_Load(object sender, EventArgs e)
    //{
    //    this.button1.Click += new EventHandler(button1_Click);
    //}

    public void button1_Click(object sender, EventArgs e)
    {
        System.Diagnostics.ProcessStartInfo myBatStartInfo = new 
System.Diagnostics.ProcessStartInfo();
        myBatStartInfo.UseShellExecute = true;  // needed since bat is not an executable
        myBatStartInfo.FileName = @"C:\BATs\TrainingProZ_10_EC_autoscale.bat";

        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using System.Web.UI;
        using System.Web.UI.WebControls;
        using System.Diagnostics;

public partial class Simulators : System.Web.UI.Page
    {


        private System.Diagnostics.Process myBatProcess;

        //private void Form1_Load(object sender, EventArgs e)
        //{
        //    this.button1.Click += new EventHandler(button1_Click);
        //}

        public void button1_Click(object sender, EventArgs e)
        {
            System.Diagnostics.ProcessStartInfo myBatStartInfo = new System.Diagnostics.ProcessStartInfo();
            myBatStartInfo.UseShellExecute = true;  // needed since bat is not an executable
            myBatStartInfo.FileName = @"C:\Users\175020\Desktop\ProZ_10_EC_autoscale.bat";

            myBatProcess = System.Diagnostics.Process.Start(myBatStartInfo);
        }

        protected void Button2_Click(object sender, EventArgs e)
        {

        }
    }
    myBatProcess = System.Diagnostics.Process.Start(myBatStartInfo);
    }

    protected void Button2_Click(object sender, EventArgs e)
    {

    }
}

为了使它工作,F​​ileName应该使用正斜杠来定义,如下所示:

myBatStartInfo.FileName = "C://BATs//TrainingProZ_10_EC_autoscale.bat";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM