PowerTip: Display the Character for an ASCII Value

PowerTip: Display the Character for an ASCII Value

  • Comments 11
  • Likes

Summary: Learn a simple trick to display the character associated with an ASCII value.

Hey, Scripting Guy! Question I would like to display the ascii character associated with the ascii value 56. How can I do this?

Hey, Scripting Guy! Answer [char]56

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • 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.

  • Hi Ed,

    anther variant

    PS II> [convert]::ToChar(56)

    with System.Char accelertor you can do this:

    PS II> [char[]](68,99,57) -split { if([char]::IsLower($_)){$true} else{$false}}

  • 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.

    [alt-down]72[Alt-Up] etc...


    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.


  • 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.

  • @CherylB

    for range:

    PS II> [char[]](65..90)

  • I've been doing this since DOS 3.2 I believe - it's how we built menus and "graphical" screens

    1. open notepad

    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)

    174,5 «»

    176,7,8  ░▒▓

    179-100  │┤╡╢╖╕╣║╗╝╜╛┐└─┬├─┼╞╟╚

    200-223  ╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀


  • 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.

  • @Brandon Ciecko

    Do this instead: Write-Host ([char]56)