Quick tip: Easy access to special symbols

In this quick tip, I’m going to show you a way to organize and quickly access special symbols in PowerShell.
You might know that you can access a characters ASCII value by the following command

[int][char]'%'

By using this command we are getting the ASCII value of the ‘%’ character. But there are more ASCII characters, or symbols, than we have easy access to through the keyboard. The way to access these symbols are like this

[char]9834

This command will display a note symbol.

If you have a small collection of these symbols you would like to have within easy reach, just collect them all in an object, and add it to your PowerShell profile for ease of access. I have created a starter object for you that you can start with if you want.

Using this object, you can try out the following commands to see how it works

Write-Host "Done with task #1 $($symbols.CHECKMARK)"
Write-Host "CompanyName$($symbols.TRADEMARK) $($symbols.COPYRIGHT) 2015"

Please note though, that the available ASCII symbols varies between character sets (fonts). So if you use a specific font, and use characters that are unique to that font, your colleague will probably not see that symbol unless he/she is using the same font as you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s