我到处寻找这个答案。这是在单击网页上的按钮1时调试期间。我尝试了几个目录,所有目录都没有运气。有什么建议。我绝对肯定这不是路径名的问题。
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:BATsTrainingProZ_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:Users175020DesktopProZ_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)
{
}
}
应使用这样的前向斜线来确定起作用的文件名:
myBatStartInfo.FileName = "C://BATs//TrainingProZ_10_EC_autoscale.bat";