当前文件夹下所有包含的拓展名
Get-ChildItem -Recurse | ForEach-Object {
if (-not $_.PSIsContainer) {
$_.Extension
}
} | Sort-Object -Unique
将A文件夹内所有的png文件复制到B文件夹
$sourceFolder = "C:\Path\To\A"
$destinationFolder = "C:\Path\To\B"
Get-ChildItem -Path $sourceFolder -Recurse -Filter *.png | ForEach-Object {
$dest = Join-Path -Path $destinationFolder -ChildPath $_.Name
Copy-Item -Path $_.FullName -Destination $dest
}