列出当前目录下的文件及文件夹的大小【Windows】
按 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"
}
}
即可看到当前目录下的文件及文件夹的大小:

1万+

被折叠的 条评论
为什么被折叠?



