LANCommander/LANCommander.Server/Snippets/Examples/Sanitize Filename.ps1

2 lines
150 B
PowerShell
Raw Permalink Normal View History

# Takes the variable $Filename, splits it by invalid characters, then joins using _
$Filename.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'