using System;
using System.Collections.Generic;using System.Text;using System.Diagnostics;using System.IO;using System.Windows.Forms;namespace Aofax
{ class GetProcessPath { static string processPath; public static string GetPath(string processName) { Process[] processes = System.Diagnostics.Process.GetProcesses();//获取系统进程; foreach (Process process in processes) { if (process.ProcessName == processName)//获取指定进程名的路径 { processPath = Path.GetDirectoryName(process.MainModule.FileName); break; } else { MessageBox.Show("未能找到指定的进程,无法自动获取路径,请手动选择路径", "提示"); } } return processPath; } }}