查找C:\WINNT\SYSTEM32下所有的dll文件,并把指定大小的文件显示出来,比如说我指定将123字节的dll文件显示再text1.text中,请问如何做呢?

解决方案 »

  1.   

    '将dir过滤的结果保存在c:\Alldll.txt中,然后分析并找出指定大小的文件列出来
    Shell ("c:\windows/system32\cmd.exe /c dir c:\windows\system32\*.dll >c:\Alldll.txt"), vbHide
      

  2.   


    Private Sub Command1_Click()
        
        Dim SysPath As String
        Dim myFile As String
        Dim lngFile As Long
        
        SysPath = VBA.Environ("windir") & "\system32\"
        myFile = Dir(SysPath & "\*.dll")
        While myFile <> ""
            lngFile = FileLen(SysPath & myFile) / 1024 '如果要的是字节长度就不用除1024
            If lngFile <= 123 Then Debug.Print myFile & " " & lngFile
            myFile = Dir
        Wend
        
    End Sub