I have the following code:
if(Test-Path $filename ) {
# Remove quotes (")
(get-content $filename) -replace('"','') | Out-File $filename -Force
$allText = [IO.File]::ReadAllText("$filename") -replace "`r`n?", "`n"
$encoding = New-Object System.Text.ASCIIEncoding
[IO.File]::WriteAllText("$filename", $allText, $encoding)
}
but I think it’s kinda nonsense to do two -replaces. Is there a way I can combine the two?
Does this work for you?
}