Board logo

标题: vbs遍历当前目录所有文件 [打印本页]

作者: batman    时间: 2009-4-6 14:59     标题: vbs遍历当前目录所有文件

  1. dim path,allfile
  2. set wshshell=createobject("wscript.shell")
  3. path=wshshell.currentdirectory
  4. set objfso=createobject("scripting.filesystemobject")
  5. set objfolders=objfso.getfolder(path).subfolders
  6. for each objfolder in objfolders
  7.      path=objfolder:allfile=""
  8.      set objfiles=objfso.getfolder(path).files
  9.      for each objfile in objfiles
  10.           allfile=allfile&vbcrlf&objfile.name
  11.      next
  12.      wshshell.popup objfolder&"下的文件:"&vbcrlf&allfile,3
  13. next
  14. set objfiles=nothing
  15. set objfolders=nothing
  16. set objfso=nothing
  17. set wshshell=nothing
复制代码

[ 本帖最后由 batman 于 2009-4-6 15:02 编辑 ]
作者: Batcher    时间: 2009-4-6 15:11

微软脚本中心有些例子
http://www.microsoft.com/china/t ... folder/default.mspx




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2