wojkxlq 发表于 2018-9-3 08:17:48

powershell 脚本快速获取文件夹的大小

  $startFolder = "C:\users"
$colItems = (Get-ChildItem $startFolder| Where-Object {$_.PSIsContainer -eq $True} | Sort-Object)foreach ($i in $colItems)    {      $subFolderItems = (Get-ChildItem $i.FullName -recurse | Measure-Object -property length -sum)      $i.FullName + " -- " + "{0:N2}" -f ($subFolderItems.sum / 1MB) + " MB"    }
页: [1]
查看完整版本: powershell 脚本快速获取文件夹的大小