本帖最后由 Demon 于 2011-7-18 12:07 编辑
- Function format_size(size)
- On Error Resume Next 'For Log(0)
- sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB")
- i = Int(Log(size) / Log(1024))
- format_size = Round(size / 1024 ^ i, 2) & sizes(i)
- End Function
-
- 'Example
- Set fso = CreateObject("Scripting.FileSystemObject")
- size = fso.GetFolder(".").Size
- WScript.Echo format_size(size)
复制代码
|