Windows – Why does running PowerShell change the console font

powershellpowershell-4.0windowswindows 8.1

I have a strange problem on my laptop – when I run Powershell within an existing console window, the font choice for the window changes.

For example, this is cmd.exe immediately after opening the window:
command console when opened

The fonts, window size and colours used are correct – the font is Lucida Console at 16pt.

Then, I run PowerShell and this is the result:

enter image description here

The font has changed to "Raster Font" at 12×16 pixels! Other window properties – colours, row count, column count – are unchanged.

Any idea why it switches?

Note: while researching this – because the Raster Font is horrendously ugly and it bugs me – I have found others reporting problems setting the font for the powershell console window (such as the question "Cannot change powershell default font to Lucida Console"). Though my problem is different (since I'm starting Powershell from an existing console window, not from the start screen), I suspect a solution for one might help the other.

Best Answer

For me it was because the batch file was in UTF-8 (needed that for accent and special char).
What I did was to change the code-page to 437 right before starting the command.

chcp 437 > nul
Powershell.exe -executionpolicy unrestricted -File  X:\Scripts.ps1
Related Question