Remove-InvalidFileNameChars

1.4

Remove-InvalidFileNameChars accepts a string and removes characters that are invalid in Windows file names.  It then outputs the cleaned string.  By default the space character is ignored, but can be included using the RemoveSpace parameter.

The Replacement parameter will replace the invalid characters with the specified string.

The Name parameter can also clean
Remove-InvalidFileNameChars accepts a string and removes characters that are invalid in Windows file names.  It then outputs the cleaned string.  By default the space character is ignored, but can be included using the RemoveSpace parameter.

The Replacement parameter will replace the invalid characters with the specified string.

The Name parameter can also clean file paths. If the string begins with "\\" or a drive like "C:\", it will then treat the string as a file path and clean the strings between "\".  This has the side effect of removing the ability to actually remove the "\" character from strings since it will then be considered a divider.
Show more

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Script -Name Remove-InvalidFileNameChars -RequiredVersion 1.4

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

2016 Chris Carter

Package Details

Author(s)

  • Chris Carter

Tags

RegularExpression StringFormatting InvalidFileNameCharacters

Functions

Remove-Chars

Dependencies

This script has no dependencies.

FileList

Version History

Version Downloads Last updated
1.5.1 1,256 8/16/2016
1.4 (current version) 79 3/7/2016