March 2nd, 2015

PowerTip: Use PowerShell to Show Illegal File Name Characters

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to display illegal characters for a file name.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily obtain a list of characters that are not permitted in file names?

Hey, Scripting Guy! Answer Use the GetInvalidFileNameChars static method from the System.IO.Path .NET Framework class:

[System.IO.Path]::GetInvalidFileNameChars()

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback