日期:2014-05-17 浏览次数:20426 次
Process p = new Process(); p.StartInfo.FileName = "notepad.exe"; p.Start(); p.WaitForExit(); Environment.Exit(0);
------解决方案--------------------
A.exe Process proB = new Process(); proB.StartInfo.FileName = "B.exe"; proB.StartInfo.Arguments = Process.GetCurrentProcess().Id.ToString(); proB.Start(); B.exe static void Main(string[] args) { int proAId; if(args.Length > 0) { int.TryParse(args[0], out proAId); } // do something if(proAId > 0) { Process proA = Process.GetProcessById(proAId); if(proA != null) { proA.Kill(); } } }