# 运行 powershell 复制下面命令执行 Get-ChildItem -Directory | ForEach-Object { $folder = $_ $totalSize = (Get-ChildItem -Path $folder.FullName -Recurse | Measure-Object -Property Length -Sum).Sum $sizeInGB = "{0:N2}" -f ($totalSize / 1GB) $sizeInMB = "{0:N2}" -f ($totalSize / 1MB) Write-Host "Folder: $($folder.Name) Size: $($sizeInGB) GB ($($sizeInMB) MB)" }
标签:02windows,Object,当前目录,totalSize,Sum,Get,文件夹,folder From: https://www.cnblogs.com/chenzhi2023/p/18229423