Avatar of rookie_b
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

How to rename a file to only contain allowed characters in Windows

Having to copy some files using robocopy and coming across some errors due to illegal characters. Normally, ft it is the same type of issue, e.g. - always a trailing space, or always a trailing dot, I would rename them targeting and  trimming the particular problem character. However, this time I have come across a folder with all sorts of different characters, mostly standing for emojis in a .msg file name, like this:
Is there a way to strip the illegal characters from the name? How do I generate a name using only allowed characters and dropping or replacing anything else?

Thank you!
PowershellWindows OSWindows Server 2012Windows Server 2008

Avatar of undefined
Last Comment

8/22/2022 - Mon