需求:查看Windows某个文件夹所有一级子文件夹大小,并按照从大到小排序 解决方案:使用Powershell脚本 脚本内容如下functionfilesize(){ [string]$filepath=".\"$sortedlength=@{}$sorted=@{}if($filepath-eq$null){throw"路径不能为空"} dir-Path$filepath|ForEach-Object-Process{if($_.psiscontainer-eq$true){$length=0$name=$_.namedir-Path$_.fullname-Recurse|ForEach-O