Jan 23, 2008

自訂副檔名搜尋

SearchFileByExt.vbs

start = Now
WScript.Echo("Start:" & start)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile where Extension = 'mp3' OR Extension = 'wma'")
For Each objFile in colFiles
Wscript.echo(objFile.Caption)
'objFile
'objFile.Delete
Next
finish = Now
WScript.Echo("Finish:" & finish)
WScript.Echo("Cost:" & DateDiff("n",start,finish))

No comments: