I have a list of files like this:
Test.(file1)[text].txt
Test.(file2)[text].txt
Test.(file3)[text].txt
I need to remove any "()","[]" and any ".", replace them spaces without changing the file extension. I've tried the following but it's not working:
dir C:\scratch\*.txt | % { Rename-Item $_ ($_.basename -replace "\(", " "`
-replace "\)", " "`
-replace "\[", " "`
-replace "\]", " "`
-replace ".", " ")}
Ideally the file name should end up in the format "Test file1 text.txt"