Hey, Scripting Guy! Blog Hey, Scripting Guy! Blog
Learn about Windows PowerShell
PowerTip: Display the Character for an ASCII Value
Summary: Learn a simple trick to display the character associated with an ASCII value.
I would like to display the ascii character associated with the ascii value 56. How can I do this?
Cancel reply
Its looking like fun, but microsoft would have seperate stuff for tips and tricks
At a PosH prompt:
Hold done the 'Alt' key and type each of the following numbers on the numeric keypad. After each number relese teh 'Alt' key and then key dwn for the next number.
Yet another way to enter data into PowerShell.
For more fun try this sequesnce and watch the screen closely.
Remember â hold the alt key and type the full number that is between the commas and then relese the alt. hold the alt key for each number.
Here is a full chart of the codes.
Hi, I'm getting e-mails from this list, but they're not necessarily related to my live account. I would like to unsubscribe, but can't figure out how. There is no unsubscribe link at the bottom of the e-mail (like you perhaps see in every other list or junk mail you receive). If you can help, please do!
@Aaron There is no unsubscribe link because there is no list. If you are getting emails from this blog, it is probably because you have subscribed to the RSS feed (or perhaps someone is spoofing you). You may check your mail client, to see if you are subscribed to the RSS feed, and to tell it to unsubscribe. Hope this helps.
PS II> [convert]::ToChar(56)
with System.Char accelertor you can do this:
That's great for one character, but how do I display a range? Can't do something like 1..10 | write-host "[char]$_" I know I'm missing something simple.
I've been doing this since DOS 3.2 I believe â it's how we built menus and "graphical" screens
2. hold down alt key
3. ON NUMERIC PAD, type ascii value that you'd like to see the character for â (in your example 56)
4. release alt key
5. character mapping to ascii(56) will appear â in this case, the number 8
NOTE: line draw characters will appear in the 174-223 range as seen below (well hopefully)
Using Ed's tip as a start, you can easily find the ascii value for any character:
this does not work in a Write-Host command.
I.E. "Write-Host [char]56" Outputs "[char]56" not the ASCII character who's value is 56.
Is the syntax wrong here? I tired variants such as "char[56]" and played with quotes for interloping, no success.