'得到脚本文件所在的当前目录
Function GetCurrentFolderFullPath
Set fso = CreateObject("Scripting.FileSystemObject")
GetCurrentFolderFullPath = fso.GetParentFolderName(WScript.ScriptFullName)
End Function
'vbs递归遍历当前目录下的所有文件夹和子文件夹
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 & ";" & GetSubFolders(subFolder.Path) & GetSubFolders
Next
End Function
MsgBox GetSubFolders(GetCurrentFolderFullPath)