using System; using System.Management; class Example { static void Main(string[] args) { string processName = "javaw"; // 进程名称,可根据实际情况进行修改 ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE Name='" + processName + ".exe'"); foreach (ManagementObject process in searcher.Get()) { string commandLine = process["CommandLine"].ToString(); Console.WriteLine("Process {0} started with command line: {1}", processName, commandLine); } } }
标签:process,string,processName,c#,commandLine,System,获取,ManagementObjectSearcher,命令行 From: https://www.cnblogs.com/nanfei/p/17407550.html