如何使用C#代码从我的终端(Windows-CE5.0)杀死进程Windows\MyProcc.exe?
发布于 2011-09-05 20:33:03
首先,通过提供正在运行的exe的名称找到该进程并杀死它。使用System.Diagnostics命名空间。
Process[] Prs = Process.GetProcessesById(RunninExe);
if (Prs.Length > 0)
{
foreach (Process Prss in Prs)
{
Prss.Kill();
}
}发布于 2011-09-05 22:29:19
答案是您必须使用工具帮助API。包括枚举进程和终止选定进程的There's a full example on MSDN。
发布于 2013-05-13 22:51:28
代码项目所做的正是您想要的。我发现这个类在终止CE中的进程方面非常有用。
http://www.codeproject.com/Articles/36841/Compact-Framework-Process-class-that-supports-full
ProcessInfo[] list = ProcessCE.GetProcesses();
foreach (ProcessInfo pinfo in list)
{
if (pinfo.FullPath.EndsWith("MyExe.exe"))
pinfo.Kill();
}https://stackoverflow.com/questions/7307998
复制相似问题