C# 打开关闭EXE文件
这个是在程序里打开EXE文件的语句,Process.Start("XXX.exe");
请问,在程序里如何关闭已打开的EXE文件?
------解决方案--------------------findwindow
sendmessage
------解决方案--------------------Process[] myProcess = Process.GetProcessesByName("XXX.exe");
foreach(Process process in myProcess)
{
process.Kill();
}
*****************************************************************************
签名档: http://feiyun0112.cnblogs.com/
------解决方案-------------------- System.Diagnostics.Process[] myProcesses=System.Diagnostics.Process.GetProcesses();
foreach(System.Diagnostics.Process myProcess in myProcesses)
{
if ("XXX.exe"==myProcess.ProcessName)
myProcess.Kill();
}
================
public static void StopProcess(string processName)
{
try
{
System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName(processName);
foreach (System.Diagnostics.Process p in ps)
{
p.Kill();
}
}
catch (Exception ex)
{
throw ex;
}
}
------解决方案--------------------检查进