将以下脚本命名为test.ps1, 并在powershell下运行.\test.ps1即可。
#list all folder and file size of specific filepath folder
function filesize ([string]$filepath)
{
if ($filepath -eq $null)
{
throw file path cannot be blank
}
$_.name + file size(MB) -f $l | Out-File ($filepath+test.txt)