日期:2014-05-17 浏览次数:20395 次
private void MTimedEvent(object source, System.Timers.ElapsedEventArgs e)
{
//你要实现的方法
if (!CheckProcess("GSM串口调试助手"))
{
WriteMsg("线程不存在,准备重启");
ProcessStart("C:\\Users\\Administrator\\Desktop\\短信猫\\GSM串口调试助手\\GSM串口调试助手.exe");
}
}
public Process ProcessStart(string fileName, string command=null)
{
try
{
Process process = new Process();
process.StartInfo.FileName = fileName;
process.StartInfo.Arguments = command;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = false;
process.Start();
return process;
}
catch (Exception ex)