[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. Dim ws
  2. Set ws = CreateObject("WScript.Shell")
  3. If WSH.Arguments.Count = 0 Then
  4.     ws.Run "cscript " & chr(34) & WSH.ScriptFullName & chr(34) & " ARG", 0
  5.     WScript.Quit
  6. End If
  7. Dim folderPath, iCount, str, objExec
  8. folderPath = InputBox("输入要遍历的文件夹路径")
  9. If isEmpty(folderPath) Then WScript.Quit
  10. iCount = 0
  11. str = ""
  12. Set objExec = ws.Exec( "cmd /c dir /b /a-d /s " & chr(34) & folderPath & chr(34) )
  13. Do Until objExec.StdOut.AtEndOfStream
  14.     iCount = iCount + 1
  15.     str = str & objExec.StdOut.ReadLine & vbLf
  16.     If iCount Mod 10 = 0 Then
  17.         MsgBox str
  18.         str = ""
  19.     End If
  20. Loop
  21. If str <> "" Then MsgBox str
复制代码

TOP

返回列表