using System.Management;
private void WmiTest()
{
using (ManagementObjectSearcher mos = new ManagementObjectSearcher(
"SELECT CommandLine FROM Win32_Process WHERE ProcessId = 1234"))
{
foreach (ManagementObject mo in mos.Get())
{
Console.WriteLine(mo["CommandLine"]);
}
}
}
参考这里https://social.msdn.microsoft.com/forums/vstudio/en-US/8efe163b-927e-4895-9983-b8c47b515d7c/how-to-get-the-command-line-parameters-from-a-different-process-in-c