This expression:
@("[char]3 [char]0 [char]2 [char]3 [char]1")
... creates an array with one element. You need commas between terms if you really want an array of 5 elements but -replacedon't support arrays anyway. In addition, your only element contains the literal characters you typed; not what you expected.
You need to create a simple string to feed to -replace; this is a little more important when dealing with non-printable characters. You had the right idea - you just need to tell PowerShell to interpolate the code expressions inside your string using the notation $()for each expression:
$CR = "$([char]3)$([char]0)$([char]2)$([char]3)$([char]1)"
source
share