如何通过运行.bat文件获取驱动器总空间和可用空间。在PowerShell脚本中是可能的。但我不应该使用电源外壳。在我需要的基本脚本编程中。我曾尝试下面的代码,但它没有给出正确的结果驱动器(C:/ D:/ E:/).bat文件中的详细信息
fsutil volume diskfree C:\>temp.txt
FOR /F "Tokens=* skip=1 delims= " %%A IN (temp.txt) DO echo %%A>>temp2.txt
SORT /+32 temp2.txt /O temp3.txt
FOR /F "tokens=5 Delims=: " %%A IN (temp3.txt) DO ECHO %%A>temp4.txt
FOR /f "tokens=1 Delims= " %%A IN (temp4.txt) DO SET a=%%A
set /a b=%a:~0,-10%
set /a c=b*1024
PAUSE
DEL temp.txt
DEL temp1.txt
DEL temp2.txt
DEL temp3.txt
DEL temp4.txt
CLS
ECHO %b% GB (%c% MB)
PAUSE
http://stackoverflow.com/questions/293780/free-space-in-a-cmd-shell – Ofiris