Vbscript list all PDF files in folder and subfolders

前端 未结 7 1644
甜味超标
甜味超标 2020-12-03 14:18

Well here is my code but I just can not filter the listing using the objFile.Extension i am sure it is some thing silly

Set objFSO = CreateObject(\"Scripting         


        
7条回答
  •  Happy的楠姐
    2020-12-03 14:53

    You'll want to use the GetExtensionName method on the FileSystemObject object.

    Set x = CreateObject("scripting.filesystemobject")
    WScript.Echo x.GetExtensionName("foo.pdf")
    

    In your example, try using this

    For Each objFile in colFiles
        If UCase(objFSO.GetExtensionName(objFile.name)) = "PDF" Then
            Wscript.Echo objFile.Name
        End If
    Next
    

提交回复
热议问题