作成 2012.03.20
更新 2012.03.20
VBScript でフォルダを再帰的に表示する
コード
Option Explicit

Dim FSO,RootPath
Set FSO = CreateObject("Scripting.FileSystemObject")
RootPath = "."
If WScript.Arguments.Count > 0 Then
  RootPath = WScript.Arguments(0)
End If

Call ListFolder(RootPath)
WScript.Quit

Sub ListFolder(Path)
  Dim f,sf,f1,fs
  Set f = FSO.GetFolder(Path)
  Set sf = f.SubFolders
  For Each f1 In sf
    WScript.Echo Path & "\" & f1.Name
    ListFolder(Path & "\" & f1.Name)
  Next
  Set fs = f.Files
  For Each f1 In fs
    WScript.Echo Path & "\" & f1.Name
  Next
End Sub
タグ: VBScript

©2004-2017 UPKEN IPv4