# # Script.ps1 # $scriptPath=$PSScriptRoot #$scriptPath="" cd $scriptPath Remove-Item -Recurse -Force "resized" mkdir "resized" Write-Host $scriptPath $files = Get-ChildItem $scriptPath -Filter *.jpg foreach ($file in $files) { $oldPath=$file.FullName $baseName=$file.BaseName $ext=$file.Extension $newPath="$scriptPath\resized\$baseName-1000x1000$ext" #Copy-Item $oldPath $newPath magick "$oldPath" -resize 1000x1000 -background white -gravity center -extent 1000x1000 "$newPath" } Write-Host "Press any key to continue ..." $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")