move-item doesn’t work in loop


So while trying to help someone rename files with [], I found out move-item doesn’t work in a loop. It seems to work just fine outside the loop.



Update: Based on the comment below, I want to clarify this: The special characters in the file names require you to use -LiteralPath parameter. -Path cannot handle those characters. Outside a loop, -Path works since you are escapting the special characters using `. This isn’t possible when walking through a collection.

In a loop, you need to use -LiteralPath parameter instead of -Path.

SO, this will be:


move-item doesn’t work in loop by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply