我的部分程序是这样的:
- C# code
if (File.Exists(path_pre + "beijing.opx")) { WinExec(@"E:\noise\noisemap\Noisemap\NMap\Run Beijing NMap Case.bat", 5); } else { Response.Write("<script>alert('.opx文件不存在!');</script>"); } ChangeName();
在执行完WinExec()(这里是运行一个软件)之后,后面的ChangeName()函数就没执行,怎样解决这个问题?
------解决方案--------------------------------------------------------
try
{
Process pro=new Process();
pro.StartInfo.UseShellExecute=true;
pro.StartInfo.FileName=@ "c:\1.bat ";
pro.StartInfo.CreateNoWindow=true;
pro.Start();
}
catch(Exception ex)
{MessageBox.Show(ex.Message);}
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
pro.Start(); 后面应该加上一句
pro.WaitForExit();