WSH 関連情報 †
VBScript †
ファイルのリストを表示するプログラム †
- サンプルコード
' FileList.vbs
' Usage : CScript //NoLogo FileList.vbs
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim folder
Set folder = fso.GetFolder(".")
Dim subFolder
For Each subFolder In folder.SubFolders
WScript.Echo _
subFolder.DateCreated & " " & _
subFolder.DateLastModified & " " & _
subFolder.DateLastAccessed & " " & _
"<DIR> " & subFolder.Name
Next
Dim file
For Each file In folder.Files
WScript.Echo _
file.DateCreated & " " & _
file.DateLastModified & " " & _
file.DateLastAccessed & " " & _
file.Name
Next
- 実行結果
D:\home\edu\VBScript\FileList>CScript //NoLogo FileList.vbs
2004/06/08 17:28:03 2004/06/08 17:28:03 2004/06/08 17:28:03 <DIR> aaa
2004/06/08 17:28:06 2004/06/08 17:28:06 2004/06/08 17:28:06 <DIR> bbb
2004/06/08 17:39:47 2004/06/08 17:39:40 2004/06/08 17:39:47 FileList.vbs
2004/06/08 17:23:07 2004/06/08 17:23:07 2004/06/08 17:23:07 test.tt
2004/06/08 17:21:12 2004/06/08 17:39:40 2004/06/08 17:39:40 test.vbs
|