Pages

9/04/2011

Powershell Character Set Lookup

Awesome conversion of ansi code numbers to characters from the cmdline.
[int] [char] 'a'   returns:  97
[char] 97  returns:  a

Troubleshooting a problem led me to look at a registry key and it contained item named value that appeared to be numeric codes for characters separated by commas and a null character (0) so I pasted it in a text editor and used search and replace to remove ", 0".  Then I pasted that into the powershell cmdline to populated a string:

$LIST=97, 116, 108, 102, 115, 48, 49, 46, 117, 115, 97, 46, 100, 111, 109, 97, 105, 110, 46, 99, 111, 109

foreach ($char in $LIST) { [char] $char >>OUTPUT.TXT }

[char] 9786 !

No comments: