Get-ChildItem -Path e:\pliki\*.txt -File | ForEach-Object {
$currentFile = $_.Name
$newName = $_.Name -replace "stary_fragment_nazwy", "nowy_fragment_nazwy"
Rename-Item -path $_ -NewName $newName
Write-Host "Renamed file $currentFile to $newName"
}
lub inaczej:
get-childitem *txt | foreach {
rename-item $_ $_.name.replace("stary_fragment_nazwy","nowy_fragment_nazwy")
}
Więcej nt. zmiany nazw plików: https://lazyadmin.nl/powershell/rename-files/