问题
Is there any way to write something like this in Powershell? (Linux would be with Perl)
char foo = '\x41';
I need to input some non-printable characters to one of my programs
回答1:
You can do it by casting an int to char.
With a decimal number :
$foo = (65 -as [char])
And from hexa :
$foo = (0x41 -as [char])
Both will set $foo
to A
回答2:
Short form is:
$foo = [char]0x41
来源:https://stackoverflow.com/questions/24626455/writing-a-hex-escaped-char-in-powershell