Function TreeIt(sPath) Set oFso = CreateObject("Scripting.FileSystemObject") Set oFolder = oFso.GetFolder(sPath) Set oSubFolders = oFolder.Subfolders Set oFiles = oFolder.Files For Each oFile In oFiles WScript.Echo oFile.Path Next For Each oSubFolder In oSubFolders WScript.Echo oSubFolder.Path TreeIt(oSubFolder.Path)'递归 Next Set oFolder = Nothing Set oSubFolders = Nothing Set oFso = Nothing End Function TreeIt("c:/1") '遍历