遍历对象中的元素
http://www.w3school.com.cn/vbscript/vbscript_looping.asp- Set fso = CreateObject("Scripting.FileSystemObject")
-
- For Each file In fso.GetFolder("c:\").Files
- WScript.Echo "[" & file.DateLastModified & "] " & file.Name
- Next
-
- Set fso = Nothing
复制代码 大致相当于批的:- dir /b /a-d c:\>files.txt
-
- for /f "delims=" %%a in (files.txt) do (
- echo [%%~ta] %%~nxa
- )
-
- del files.txt>nul
复制代码
|