Remove-InvalidFileNameChars
SYNOPSISโ
Remove invalid characters from the supplied string.
SYNTAXโ
Remove-InvalidFileNameChars [-Name] <String> [<CommonParameters>]
DESCRIPTIONโ
Remove invalid characters from the supplied string and returns a valid filename as a string.
EXAMPLESโ
EXAMPLE 1โ
Remove-InvalidFileNameChars -Name "Filename/\1"
PARAMETERSโ
-Nameโ
Text to remove invalid filename characters from.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
CommonParametersโ
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTSโ
System.Stringโ
A string containing invalid filename characters.โ
OUTPUTSโ
System.Stringโ
Returns the input string with the invalid characters removed.โ
NOTESโ
This functions always returns a string however it can be empty if the name only contains invalid characters. Do no use this command for an entire path as '' is not a valid filename character.