以下代码是从网上下载的看不懂求解释,怎么用vbs脚本遍历目录。貌似很多地方都没提到郁闷 - Function GetCurrentFolderFullPath
-
- Set fso = CreateObject("Scripting.FileSystemObject")
- GetCurrentFolderFullPath = fso.GetParentFolderName(WScript.ScriptFullName)
- End Function
- Function GetSubFolders(currentFolderFullPath)
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set currentFolder = fso.GetFolder(currentFolderFullPath)
- Set subFolderSet = currentFolder.SubFolders
- For Each subFolder in subFolderSet
- 'MsgBox "subFolder.Path=" & subFolder.Path
- GetSubFolders = subFolder.Path & vbcrlf & GetSubFolders & GetSubFolders(subFolder.Path)
- Next
- End Function
- MsgBox GetSubFolders(GetCurrentFolderFullPath)
复制代码
|