Initial Commit
This commit is contained in:
commit
aba605f60a
1 changed files with 14 additions and 0 deletions
14
Remove-InvalidCharacters.ps1
Normal file
14
Remove-InvalidCharacters.ps1
Normal file
|
@ -0,0 +1,14 @@
|
|||
Function Remove-InvalidCharacters {
|
||||
[CmdletBinding()]
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$String,
|
||||
[Parameter(Mandatory=$false)]
|
||||
$ReplacementCharacter = ''
|
||||
)
|
||||
|
||||
$InvalidCharacters = [RegEx]::Escape(-join $([System.IO.Path]::GetInvalidFileNameChars()))
|
||||
|
||||
return [RegEx]::Replace($String, "[$InvalidCharacters]", $ReplacementCharacter)
|
||||
}
|
Loading…
Reference in a new issue