Windows PowerShell Font Customization

  • Comments 6

Windows PowerShell Font Customization


<Today we have a guest blog entry from another team in Microsoft>

There’s a new set of fonts that have been developed and released this year bundled with the betas for the new Windows and Office.  These 6 fonts are collectively called The Microsoft ClearType Font Collection.  They are designed for on-screen reading with ClearType enabled.  In short, this means that if you have an LCD display then text written in these fonts will be more readable.  One of these fonts in particular, Consolas, is of interest to us programmers, shell scripters and IT folk.  Consolas is described as “a monospaced font (like an old typewriter) and good for programmers setting code (its core purpose).”  We’re going to install it for use in PowerShell.

First of all, you need to obtain the font.  If you have the Windows Vista beta or the Office 2007 beta, you already have it.  If you have a licensed copy of Visual Studio 2005, you can download the Consolas font for free.  Another prerequisite is to enable ClearType on your LCD.  If ClearType is not enabled then Consolas will actually look worse than using the default fonts!

The next step, once the font is installed, is to register it for use in the Console.  You can run the PS script below (provided by Lee Dohm) as an administrator or you can follow the manual steps in KB article Q247815.

You then need to log out (on Vista) or reboot on XP (log out might be sufficient but I haven’t tried it.)  Then open up a console, click the control box (upper left corner of the window) and choose Properties.  The Font tab contains a list of Console-enabled fonts including the new entry, Consolas.  Choose it, pick a nice size for it and click Ok.

$key = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
## Find out if Consolas is installed on the system
if(!(test-path (join-path $env:windir "Fonts\CONSOLA.TTF")))
        write-host "The Consolas font is not installed on the system."
        write-host "Install Microsoft Office 2007 Beta to obtain the font."
## Determine if Consolas is already installed as a command window font
$installed = get-itemproperty $key |
             get-member |
             where-object { $_.Name -match "^0+$" } |
             where-object { $_.Definition -match "Consolas" }
if($installed -ne $null)
        write-host "The Consolas font is already installed as a command window font."
## Find out what the largest string of zeros is
$zeros = (get-itemproperty $key |
         get-member |
         where-object { $_.Name -match "^0+$" } |
## Install the font
new-itemproperty $key -Name ("0" * ($zeros + 1)) -Type string -Value "Consolas"
write-host "Consolas font installed successfully as a command window font."


Aaron Lieberman is a developer at Bungie Studios focused on user interface and networking.
Lee Dohm is a developer in MSTV Engineering Services Build & Tools and wrote the script.


Leave a Comment
  • Please add 8 and 6 and type the answer here:
  • Post
  • That's funny. A week ago I did exactly the same manually :). Thanks for the fine script anyway. The next time I need to add a new font to the console I'll use it instead.

  • I am really looking forward to powershell being publicly available for windows vista.  Is there a guesstimate as to when it will be available for Vista rc2?

  • Shame edit looks bad with Consolas! As I noticed a while ago:

    Any chance of a new text editor designed to take input from PowerShell? :)

  • I realize that this is an older blog entry, but has anyone else had problems using Consolas with Powershell because the Consolas font does not include the "Box Drawings" characters?

    The font is great until something opens a box (such as Powertab).  Is there a way to remap the characters U+2500 through U+256C in Powershell?

Page 1 of 1 (6 items)

Windows PowerShell Font Customization