我正在尝试编写一个脚本,它将搜索 C:\ 及其所有子文件夹以查找特定扩展名,并将所有主题保存到 CSV 文件中。我试过这个但无济于事:
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\"
Set objFolder = objFSO.GetFolder(objStartFolder)
Wscript.Echo objFolder.GetExtensionName("*.txt")
Set colFiles = objFolder.Files
For Each objFile in colFiles
If objFile.Extension = "pfx" Then
Wscript.Echo objFile.Name
End If
Next
Wscript.Echo
ShowSubfolders objFSO.GetFolder(objStartFolder)
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
Wscript.Echo
ShowSubFolders Subfolder
Next
Set WScript = CreateObject("WScript.Shell")
End Sub
我不认为我在这里走的是正确的道路。我至少不精通 vb 脚本,它恰好是我唯一被允许使用的东西。