This was discovered from the issue here: https://github.com/Microsoft/WSL/issues/2050
The issue is that if I'm using WSL, and execute a command like powershell.exe -command 'Write-output hi' | cat the console font changes to Raster fonts and it resizes the console.
Windows version:
C:\>ver
Microsoft Windows [Version 10.0.17763.292]
Steps to reproduce
HKEY_CURRENT_USER\Console to reset console to all default settings
powershell.exe -command 'Write-output hi' - no font change, and it correctly echo 'hi' to the command line:
powershell.exe -command 'Write-output hi' | cat - font changes to Raster Fonts, and windows resizes to match new font:

Some notes on the behaviour that we discovered in the previous issue:
Lucida Console as your font.Let me know if you need any further debugging or testing.
This looks like #280.
I don't think this was even Powershell's fault. I have a note sitting around here somewhere that one of the most recent .NET Frameworks (4.7something) suddenly decides to use 65001 as the default code page for all apps and when that flips back and forth with other tools and codepages as they start and exit, we recalculate the font.
(~miniksa)
As a side effect of WSL switching to ConPTY for interop hosting, this should _technically_ be fixed for this particular use case ...
This looks like #280.
I'll buy that it's a dupe for a dollar. I think I see what happened there now. Thanks Dustin.
FWIW, my PSVersion is 5.1.18329.1 and can still reproduce the issue. The purported fix to PSReadline was done back in the October 2018 timeframe. I did some PS rain dancing of questionable merit but it didn't take. My PSReadLine version is 2.0.0. DotNetFrameworkVersion claims 4.6.1 (contrast 4.7something).
But for giggles I installed PowerShell v6.2.0-preview.4 and sure enough it works with Consolas through WSL interop.
$ /mnt/c/Program\ Files/PowerShell/6-preview/pwsh.exe -command 'Write-output hi' | cat
hi
Still, it sure seems like something is rotten in Denmark. I can see Windows Console behaving badly if Jay's post was strewn with Chinese Heiti, but it isn't. Everything here is in 'merican. wsltty works alright, and they use an old-school hidden Console Window not the new fancy-schmancy ConPTY. Academic I guess. Grateful to see it all improving. Still.....
I was looking for a workaround when using $(command-that-invokes-powershell) in a script on WSL. After a horrible hack involving wscript.exe, I've now written a tiny C++ helper I called keepfont.exe that calls CreateProcess with CREATE_NEW_CONSOLE and a STARTUPINFO that shares the stdin/stdout/stderr handles and hides the resulting window. Then my script uses $(keepfont.exe command-that-invokes-powershell) instead.
It's not quite perfect, but now my script works and my font stays, at least on stock 1809. I hope this idea helps someone else keep their sanity too!
Dupe to #280
This is still broken for me on the latest fast ring. Any word on this? It totally breaks my Emacs workflow.
Still the issue here. Did assign a, variable=powershell.exe -File "somescript.ps1" then the bug occurs. It's a shame
HI, guys. I'm not sure if it could help you, but you could take one minues to try this.
https://github.com/microsoft/WSL/issues/3988#issuecomment-587328805
I seem to have fixed this by going to the registry
Computer\HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
Computer\HKEY_CURRENT_USER\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe
and changing FaceName to the font used in WSL Console.