troubleshooting Question

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

Avatar of rookie_b
rookie_b asked on
PowershellWindows OSWindows Server 2012Windows Server 2008
5 Comments1 Solution26 ViewsLast Modified:
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!
System Admin

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros