'Company: ××××
'''''''''''''''''''''''''''''''''''''''''''''''''''''

'自我学习系列

'Author: joan ''
'Product: Test
'Date: 2010.5.5

'''''''''''''''''''''''''''''''''''''''''''''''''''''


Function dirvesmsg
      msg = "驱动器名称:" & objDrive.DriveLetter & "   "
      msg =msg & "文件系统的类型:" & objDrive.FileSystem &"  "
      msg = msg & "驱动器总容量:" & int(objDrive.TotalSize/(1024*1024*1024)) & "G "
      msg = msg & "剩余空间总量:" & int(objDrive.FreeSpace/(1024*1024*1024)) & "G  "
      msgbox msg  '
End Function

 

' 创建FileSystemObject对象
Set objFSO = CreateObject("Scripting.FileSystemObject")
' 创建Drives集合,并赋值给colDrives
Set colDrives = objFSO.Drives
' 遍历Drives集合

For Each objDrive in colDrives
'判断驱动器是否已准备好
 If objDrive.IsReady Then
      dirvesmsg  ' 调用  Function
  End If
Next
reporter.ReportEvent  micDone ,"遍历Drives集合",msg

详细内容原文我的QQ blog