-2

提前感谢

我想创建一个批处理脚本,使用它获取所有驱动器的已用空间、可用空间和总空间,并将其存储到表中。

请帮我。我找到了 fsutil 命令,但未能检索到结果。

4

1 回答 1

0

将此保存为批处理文件,然后双击它,您的信息应与它一起写入 CSV。

<!-- :
@(Echo Drive,Size[GB],Used[GB],Available[GB]
    @CScript //NoLogo "%~f0?.wsf")>"MyDriveInfo.csv"
@Exit /B
-->
<Job><Script Language="VBScript">
Set o=CreateObject("Scripting.FileSystemObject")
For Each oD In o.Drives:If oD.IsReady=True Then
  Wscript.Echo oD.DriveLetter & ":," &_
  Round(oD.TotalSize/1073741824,2) & "," &_
  Round((oD.TotalSize-oD.FreeSpace)/1073741824,2) & "," &_
  Round(oD.AvailableSpace/1073741824,2)
Else:Wscript.Echo oD.DriveLetter & ":,,,":End If:Next
</Script></Job>
于 2018-07-26T19:48:38.063 回答