- On Error Resume Next
- strComputer = "."
- const x=1073741824
- Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
- Set colItems = objWMIService.ExecQuery( _
- "SELECT * FROM Win32_LogicalDisk",,48)
- For Each objItem in colItems
- y=round((objItem.FreeSpace / x),2)
- msgbox objItem.Description & ":" & objItem.Caption & " 磁盘类型:" & objItem.FileSystem & " 剩余空间:" & y & " GB"
- Next
复制代码
|