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
本文介绍了一种利用Windows Management Instrumentation (WMI)来检索特定进程的命令行参数的方法。通过C#示例代码展示了如何针对指定进程ID查询其启动时的命令行参数。
3699

被折叠的 条评论
为什么被折叠?



