- 按 Win + R 打开运行窗口,输入 PowerShell,然后按 Enter
- 复制以下脚本到 PowerShell 的命令行中,然后按 Enter
Get-ChildItem | ForEach-Object {
if ($_.PSIsContainer) {
$size = (Get-ChildItem -Recurse -File -Path $_.FullName | Measure-Object -Property Length -Sum).Sum
$sizeMB = [Math]::Round($size / 1MB, 2)
Write-Output "$($_.Name) (Folder): $sizeMB MB"
} else {
$sizeMB = [Math]::Round($_.Length / 1MB, 2)
Write-Output "$($_.Name) (File): $sizeMB MB"
}
}