标题: [问题求助] [已解决]VBS获取磁盘剩余百分比如何精确到小数点后两位? [打印本页]
作者: ydfan8888 时间: 2012-3-29 11:46 标题: [已解决]VBS获取磁盘剩余百分比如何精确到小数点后两位?
- 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)) '磁盘剩余空间百分比
复制代码
作者: batman 时间: 2012-3-29 12:39
- 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,4)
- w = (FormatPercent(a,2)) '磁盘剩余空间百分比
- MsgBox w
复制代码
作者: ydfan8888 时间: 2012-3-29 13:11
batman 发表于 2012-3-29 12:39
谢谢 已经处理
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |