【发布时间】:2011-03-04 22:31:40
【问题描述】:
提前感谢您的想法和意见。
我想通过我的程序定期检查是否有第三方程序正在用户系统上运行。我目前在 C# 中按如下方式启动该程序:
String plinkConString = ""; // my connection string
Process plink = Process.Start(utilityPath + @"\putty.exe", plinkConString);
int plinkProcessId = plink.Id;
我启动程序并在 Windows 环境中获取它的 pid。由于 Putty/PLink 可能会在某些时候断开与 SSH 服务器的连接并关闭,因此在代码中监控此过程的最佳方式是什么?
有没有更好的方法来启动这个程序来监控它的成功或失败?
【问题讨论】:
标签: c# process monitoring pid