Dim fso
Set fso = WScript.CreateObject("Scripting.Filesystemobject")
Dim fld
path=fso.GetParentFolderName(WScript.ScriptFullName)
path="d:\test\" '注释掉这句,列出脚本所在目录
If fso.FolderExists(path) Then
Set fld=fso.GetFolder(path)
Dim fl
Dim Text
For Each fl In fld.Files
Text = Text & fso.BuildPath(fl.Path,fl.Name) & vbCrLf
Next
Dim st
Set st=fld.CreateTextFile("dirList.txt")
st.Write Text
st.Close
End If