I would like to replace a few filename parameters in one pass. Trying the following results in errors claiming the 'file already exists'. Is there a way to name multiple replace parameters in a single pass?
file | Rename-Item -NewName { $_.Name -replace "parameter1", "X" , $_.Name -replace "parameter2", "Y" }
As requested, my comment as answer.
You can daisy-chain
-replace
, so in this caseSorry for the short answer, but I'm on mobile now..