var query =Before using Win32_Process, we should add System.Management.dll to the reference. Surely, we can wrap up the sample code in a function.
"select CommandLine from Win32_Process where ...";
using (var searcher = new ManagementObjectSearcher(query)) {
foreach (var result in searcher.Get()) {
// The desired cmdline is (String)result["CommandLine"]
}
}
沒有留言:
張貼留言