本帖最后由 窄口牛 于 2017-8-17 12:54 编辑
- @echo off&title 各盘容量使用情况
- set m=%date:~0,4%%date:~5,2%%date:~8,2%
- >DiskCalc1.vbs echo WSCript.Echo "盘符" ^& Chr(9) ^& "总容量(GB)" ^& Chr(9) ^& "已用空间(GB)" ^& Chr(9) ^& "剩余空间(GB)" ^& Chr(9) ^& "使用率"
- >DiskCalc2.vbs echo DeviceID = Wscript.Arguments(0)
- >>DiskCalc2.vbs echo SizeAvail = Wscript.Arguments(1) / (1024 * 1024 * 1024)
- >>DiskCalc2.vbs echo SizeTotal = Wscript.Arguments(2) / (1024 * 1024 * 1024)
- >>DiskCalc2.vbs echo SizeUsed = SizeTotal - SizeAvail
- >>DiskCalc2.vbs echo SizeRate = SizeUsed / SizeTotal * 100
- >>DiskCalc2.vbs echo WSCript.Echo DeviceID ^& Chr(9) ^& Round(SizeTotal,1) ^& Chr(9) ^& Chr(9) ^& Round(SizeUsed,1) ^& Chr(9) ^& Chr(9) ^& _
- >>DiskCalc2.vbs echo Round(SizeAvail,1) ^& Chr(9) ^& Chr(9) ^& Round(SizeRate,1) ^& "%%"
- cscript //nologo DiskCalc1.vbs >>%m%.txt
- for %%l in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
- (for /f "tokens=1-3" %%a in ('wmic LogicalDisk where "DeviceID='%%l:'" get DeviceID ^, Size ^, FreeSpace ^| findstr ":"') do (
- cscript //nologo DiskCalc2.vbs %%a %%b %%c >>%m%.txt
- )))
- del DiskCalc*.vbs
复制代码
|