Hi,
I need to replace all characters between 1 and 31 (ASCII) for space in a file.
I created a script to test but it is not working (I tried two alternatives to replace).
$a = "Test$([char]26)Test$([char]27)Test"
$File_out = Join-Path $PSScriptRoot "teste.txt"
Remove-Item $File_out -ErrorAction SilentlyContinue
Add-Content -Path $File_out -Value $a
for($codAscii=1;$codAscii -le 31;$codAscii++){
$codAscii
$b = $a.Replace([char]$codAscii," ")
$c = $a -replace [char]$codAscii," "
}
Add-Content -Path $File_out -Value $b
Add-Content -Path $File_out -Value $cResult:
What I need
Thanks in advance.
Fábio de Paula Junior