1、按钮事件
try
{Process pro = new Process();
pro.StartInfo.FileName = this.UpgradeSeo; //要调用的控制台程序
pro.StartInfo.Arguments = "1";
pro.StartInfo.CreateNoWindow = false; //控制显示窗口
pro.StartInfo.UseShellExecute = false;
pro.Start();
//pro.WaitForInputIdle();
pro.WaitForExit(60000);
if (pro.HasExited == false)
{
pro.Kill();
}
else
{
Response.Write("由外部程序正常退出!");
}
BindData();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
2、控制台代码
static void Main(string[] args)
{
DataTable dt = PRC_CategoryRules.GetAll();
string seotype = args[0];//获取参数值
foreach (DataRow dr in dt.Rows)
{