How to call WMI to search hard disk mp3 files by VBS
This article is about how VBS calls WMI to search hard disk mp3 files. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
The code is as follows:
strComputer = ". "
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\ " _
& strComputer & "\root\cimv2")
Set colFiles = objWMIService. _
ExecQuery("Select * from CIM_DataFile where Extension = 'mp3'")
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
above was
ExecQuery("Select * from CIM_DataFile where Extension = 'mp3'")
MP3 in a row can be replaced by other search files.
Thank you for reading! About "VBS how to call WMI to search hard disk mp3 files" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!