VBS调用WMI搜索文件

标签: , , ,

如果你想用递归搜索我也没办法。下面的程序搜索电脑上所有的MP3文件。

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

参考链接:WMI Tasks: Files and Folders

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. VBS Scripting.Dictionary 排序
  2. 再谈Msxml2.XMLHTTP、Msxml2.ServerXMLHTTP与缓存
  3. 用VBS获取Unix时间戳
  4. Raspberry Pi树莓派新系统SSH连接被拒绝的解决方法
  5. PathFindFileName函数,由文件路径获得文件名

一条评论 发表在“VBS调用WMI搜索文件”上

  1. ihipop说道:

    我用Everything。比你这个快

留下回复