private const string FileName = "test.exe"; //进程名称不带扩展名 private const string ProcessName = "test"; /// <summary> /// 打开进程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void Open() { try { Process.Start(string.Format(@"{0}{1}", Application.StartupPath, FileName)); } catch (Exception ex) { } } /// <summary> /// 关闭进程 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void Close() { try { //可能存在进程名相同的进程 foreach (Process process in Process.GetProcessesByName(ProcessName)) process.Kill(); } catch (Exception ex) { } }