public void RestartPro(string ProName,string FileName)
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = FileName;
Info.RedirectStandardOutput = true;
Info.WindowStyle = ProcessWindowStyle.Maximized;
this.process.StartInfo = Info;
Info.UseShellExecute = false;
this.process.Start();
this.process.Close();
process=new Process();
System.Diagnostics.Process[] pro = System.Diagnostics.Process.GetProcesses();
for(int i = 0; i < pro.Length; i++)
{
if(pro[i].ProcessName == ProName)
{
pro[i].Kill();
}
}
}
{
System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
Info.FileName = FileName;
Info.RedirectStandardOutput = true;
Info.WindowStyle = ProcessWindowStyle.Maximized;
this.process.StartInfo = Info;
Info.UseShellExecute = false;
this.process.Start();
this.process.Close();
process=new Process();
System.Diagnostics.Process[] pro = System.Diagnostics.Process.GetProcesses();
for(int i = 0; i < pro.Length; i++)
{
if(pro[i].ProcessName == ProName)
{
pro[i].Kill();
}
}
}
tskill能查杀进程,语法很简单:tskill 程序名!