我有一个正在运行的进程的ID(由我不启动)。我怎样才能获得命令行参数?
答案 0 :(得分:0)
你可以用wmi来获取这种信息
var q = string.Format("select CommandLine from Win32_Process where ProcessId='{0}'", processId);
ManagementObjectSearcher searcher = new ManagementObjectSearcher(q);
ManagementObjectCollection result = searcher.Get();
foreach (ManagementObject obj in result)
Console.WriteLine("[{0}]", obj["CommandLine"]);