简体   繁体   English

如何使用WMI获取流程说明?

[英]how to get process description using WMI?

I'm using WMI query to get a list of all processes, but what i missing is process description! 我正在使用WMI查询来获取所有进程的列表,但是我缺少的是进程描述! It appears like this when i use "Description" property! 当我使用“描述”属性时,它看起来像这样!

Name : chrome.exe            Description : chrome.exe

but it should be 但这应该是

Name : chrome.exe            Description : Google Chrome

So what's the property name that return process description? 那么返回流程描述的属性名称是什么?

public void GetProcesses()
{ 
     ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * From Win32_Process");
     ManagementObjectCollection processList = searcher.Get();
     foreach (ManagementObject obj in processList)
     {
         Console.WriteLine("Name : {0}     Description : {1}",obj["Name"],obj["Description"]);
     }
}

You have all the properties in the Win32_Process class documentation . 您具有Win32_Process类文档中的所有属性。 Looks like you're out of luck, testing some processes on my machine using wbemtest , I don't see any property that suits you needs. 看起来您不走运,使用wbemtest在我的计算机上测试了一些进程,但我看不到任何适合您的属性。 It's possible that processes don't expose such information. 进程可能不会公开此类信息。

It is not WMI, but will work for processes on your local machine. 它不是WMI,但适用于本地计算机上的进程。

You may find a description of a process [sic.], actually it is the description of the executable, using GetVersionInfo . 您可能会使用GetVersionInfo找到进程的描述[sic。],实际上是可执行文件的描述。 Than check the FileDescription and or ProductName properties . 比检查FileDescription和或ProductName 属性

Note however, that there is no guarantee that this information is available. 但是请注意,不能保证此信息可用。 Nevertheless it is probably your best bet. 不过,这可能是您最好的选择。 Other tools, like sysinternals process explorer, display that information as well. 其他工具(例如sysinternals进程浏览器)也显示该信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM