Author Posts

February 4, 2016 at 10:28 am

Is it possible with PowerShell to change the font of a string.. So that you can use Wing dings in output when using write-output or other cmdlets that deal with output?

'string'.fontName = wingdings

I know you can change the font in the Ise with
$psise.Options.FontName = 'font name'

How can you do the same thing with a string

February 4, 2016 at 10:31 am

The console application only supports specific, hardcoded fonts, and doesn't provide the ability to change just a particular string. The ISE supports a wider range of fonts, but it's a global setting – you can't change the display of a particular string. A string doesn't have a font associated with it; the font is determined by the application displaying the string.

February 4, 2016 at 10:55 am

Thanx Don. I wondered if that wasnt' the case on the hardcoding.. Thanx for the confirmation.

As you described I played around with this
[System.Drawing.FontFamily]::Families

and setting my $psise.options.fontname

[System.Drawing.FontFamily]::Families |?{$_.name -like 'wing*'}

If someone isn't looking this is a good Joke to play on someone change their font to some non nonsensical font... oh boy... you have to type out what you want in another window then run it again.

Thanx again Don.