先感谢
我想创建一个批处理脚本,通过该脚本我可以获取所有驱动器的已用空间,可用空间和总空间,并将其存储到表中。
请帮助我。我找到了fsutil命令,但无法检索结果。
答案 0 :(得分: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>