本帖最后由 jyswjjgdwtdtj 于 2023-5-6 21:54 编辑
同样遍历C:\Program Files (x86)
并生成html文档
1、fso- begin_time = Timer
- set fso= createobject("scripting.filesystemobject")
- foldername="C:\Program Files (x86)"
- set nowfolder=fso.getfolder(foldername)
- filetree nowfolder
- sub filetree(fdobject)
- set files=fdobject.files
- set folders=fdobject.subfolders
- for each file in files
- wscript.echo file.path
- next
- for each folder in folders
- wscript.echo folder.path
- filetree folder
- next
- end sub
- wscript.echo Timer-begin_time
复制代码 消耗22.0625秒(更少一些)
2.shell- begin_time = Timer、
- set shell= createobject("shell.application")
- foldername="C:\Program Files (x86)"
- set nowfolder=shell.namespace(foldername)
- filetree nowfolder
- sub filetree(fdobject)
- set items=fdobject.items
- for each item in items
- if item.isfolder then
- wscript.echo item.path
- filetree item.getfolder
- else
- wscript.echo file.path
- end if
- next
- end sub
- wscript.echo Timer-begin_time
复制代码 消耗12.64秒(如果用“滤镜”的话估计还能快)
显然,shell快太多了 |