Converting VBScript's Chr Function

Windows PowerShell

Definition: Returns the character associated with the specified ANSI character code.


Here’s a question for you: Suppose you have an ASCII value and you need to convert that value to a real character; how are you supposed to do that?

Well, one way is to simply take the integer value (ASCII values are always integer values) and convert its data type to character. This command converts ASCII 34 to a character value and then stores that value in the variable $a:

$a = [char]34

When you run this command and then echo back the value of $a you should get the following:


Return to the VBScript to Windows PowerShell home page