您可以使用以下PowerShell代码来计算所有目录的大小:
Get-ChildItem -Path "C:\" -Recurse | Where-Object { $_.PSIsContainer } | ForEach-Object {
$Size = (Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum
[PSCustomObject]@{
Folder = $_.FullName
Size = "{0:N2}" -f ($S