Only Allow A-Za-z0-9 and spaces (how?)

Occasional Visitor

Hi,

 

This powershell command removes all characters from a filename except A-Za-z0-9. 
Get-Item .\*.msg | Rename-Item -NewName { $($_.BaseName -replace "/W"," ") + $_.Extension }

But it also removes spaces, please help to adjust the command line into a command that only allows     A-Za-z0-9 and spaces!

 

Regards,

 

Edward

0 Replies