Powershell: moving items not working when filenames that have chars [ ]

Question:

Quick question about moving items with PowerShell: does anyone know why the following script does not work when the filename has the [ or ] chars on it? (ex.: file1[VT].txt)

For instance, it will move the file if it’s called file1.txt but it will simply ignore files named file1[VT].txt. I’m under the assumption that it’s not finding the path to the file when it has chars [ or ] on its name. Any ideas?

Answer:

Just using -literalpath parameter for move-item

Source:

Powershell: moving items not working when filenames that have chars [ ] by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply