English 中文(简体)
• 如何将所有WMI的row出口到档案中?
原标题:How to export all rows of a WMI query to a file?

鉴于这样的问题

SELECT * FROM WIN32_PROCESS
  1. Is there a way to interrogate the result object for the names of the columns returned?
  2. Write all the rows in the result object to a text file, say
最佳回答

是否有办法对所归还的栏目名称核对结果物体?

是的。 每一WMI物体都有Properties_,其中提供了关于该物体特性的资料。 为获得物体上的财产名称,列举了<代码>。 财产——收集和核对每个项目<代码>Name。

因此,所有各行都反对文本档案,即

Enumerate all the rows and use the FileSystemObject to write them to the desired text file. Pseudocode:

create a text file and open it for writing

for each object in the result set
  for each property in the object
    write the property value to the file

close the file


Alternatively, you could use wmic to do all the work for you:

wmic /output:e:processes.txt process get /all
wmic /output:e:processes.csv process get /all /format:csv
问题回答

暂无回答




相关问题
How can I query NTFS disk quotas in C#?

I need to be able to find, for all users on a given remote machine, those users disk quotas and actual disk usage. I need to be able to do this reporting in a C# application. (Well, technically a DLL ...

WMI Poor Performance

I wrote a code in C# that maps logical drives to their physical disks, using WMI (System.Management). The code working perfectly, but slow like hell. In my machine (Windows 7 x64, Dual-Core with 3 GB ...

Closing Open Files using C#

I have a situation where people are connected to files on a share and it s blocking me from overwriting the file. I m trying to write a method that will look to see if a filePath that I provide is ...

Binding an SSL certificate to a port programmatically

I m working on a self-hosted WCF service for which encrypted communications is an option. Everything works fine when a certificate is already bound to the port as described here. However, I want to ...

热门标签