C this several of the other driver files can be normal lookup,
Sub WMITest ()
Dim objWMIService As Object
Dim colFiles As Object
Dim objFile As Object
The Set objWMIService=GetObject (winmgmts: \ \ \ "root \ cimv2")
'for each drive root directory file
The Set colFiles=objWMIService. ExecQuery (" Select * from CIM_DataFile where path='\ \' ")
For Each objFile colFiles In
The Debug. Print objFile. The Name 'which shows the C pan-gen 11 files in the directory
Next
All files' access to disk C
The Set colFiles=objWMIService. ExecQuery (" Select * from CIM_DataFile where drive='C:' ")
For Each objFile colFiles In
The Debug. Print objFile. The Name 'only show the 4 C disk file, it's strange
Next
The Set objFile=Nothing
The Set colFiles=Nothing
The Set objWMIService=Nothing
End Sub
CodePudding user response:
Try there, and see if I can get all:Sub Test ()
Dim FSO As New FileSystemObject, bFile As File
For Each bFile In FSO. GetFolder (" c: \ "). The Files
The Debug. Print bFile. Name
Next
End Sub
CodePudding user response: