Get-WmiObject -Class Win32_LogicalDisk -Filter "DriveType=3" |
Format-Table deviceid,
@{Label="free(GB)"; Expression={($_.freespace/1GB).tostring("f1")}},
@{Label="size(GB)"; Expression={($_.size/1GB).tostring("f1")}},
@{Label="percentage(%)";Expression={"{0:p}" -f($_.freespace/$_.size)}}-AutoSize
Get-WmiObject -class Win32_LogicalDisk -Filter 'DriveType=3' |
% {"盘符 总容量 可用空间 已用空间"}{
$D=($_.DeviceID,[int]($_.Size/1GB),[int]($_.FreeSpace/1GB))
$D+=$D[1]-$D[2]
"{0,-6}{1,6:#'GB'}{2,10:#GB}{3,10:#GB}" -f $D
}
get-psdrive -psprovider filesystem