Код:

Option Explicit
Dim strDestFile
Dim objTS
Dim objFolder
With WScript.CreateObject("Scripting.FileSystemObject")
strDestFile = .BuildPath(WScript.CreateObject("WScript.Shell").SpecialFolders.Item("MyDocuments"), "текстовый файл.txt")
If .DriveExists("C:") Then
Set objTS = .CreateTextFile(strDestFile, True, True)
For Each objFolder In .GetFolder("C:\").SubFolders
objTS.WriteLine ComposeAttributesString(objFolder.Attributes) & vbTab & objFolder.Name
Next
objTS.Close
Set objTS = Nothing
Else
WScript.Echo "Drive C: not exists."
WScript.Quit 1
End If
End With
WScript.Quit 0
Function ComposeAttributesString(intAttributes)
Dim strResult
strResult = ""
If intAttributes And 16 Then strResult = strResult & "D" Else strResult = strResult & " "
If intAttributes And 2048 Then strResult = strResult & "C" Else strResult = strResult & " "
If intAttributes And 1024 Then strResult = strResult & "L" Else strResult = strResult & " "
If intAttributes And 32 Then strResult = strResult & "A" Else strResult = strResult & " "
If intAttributes And 4 Then strResult = strResult & "S" Else strResult = strResult & " "
If intAttributes And 2 Then strResult = strResult & "H" Else strResult = strResult & " "
If intAttributes And 1 Then strResult = strResult & "R" Else strResult = strResult & " "
ComposeAttributesString = strResult
End Function