- Set objWMIService = GetObject("winmgmts:")
- Set objLogicalDisk = objWMIService.get("Win32_LogicalDisk.DeviceID='e:'")
-
- s = objLogicaldisk.Size/(1024*1024*1024)
- s = round(s,2) '全部磁盘容量
- m = objLogicalDisk.FreeSpace/(1024*1024*1024)
- m = round(m,2) '剩余磁盘空间
- a = m/s
- a = round(a,2)
- w = (FormatPercent(a,2)) '磁盘剩余空间百分比
复制代码
|