- Poll: How reliable are ChatGPT and Bing Chat? - Tue, May 23 2023
- Pip install Boto3 - Thu, Mar 24 2022
- Install Boto3 (AWS SDK for Python) in Visual Studio Code (VS Code) on Windows - Wed, Feb 23 2022
You might wonder why anyone would want to change the font size of the PowerShell console with a cmdlet. If you don’t like the default font, you can easily change it through the Windows PowerShell properties. You just have to click the PowerShell icon in the upper left corner of the console and then select “Properties.”
PowerShell console - Properties
PowerShell Properties - Font size
This method has two downsides. Number one is that it involves click-click, which any real PowerShell geek will avoid at all costs. Number two is that, it is difficult to automate changing the font size this way, for instance, if you intend to deploy a PowerShell profile in your network.
This is where the SetConsoleFont module comes in. Before you can use the Set-ConsoleFont cmdlet, you have to import the module. First, copy the module to a local editor. Note that when I copied the text, the last line had an unwanted line break. Make sure that the last line of the module looks like this:
Export-ModuleMember -Variable _DefaultFont, _hConsoleScreen -Function Set-ConsoleFont, Get-ConsoleFontInfo
Next, you have to store the file in your module folder. With $env:PSModulePath on a PowerShell console, you can get a list of your module folders. For instance, you can store the SetConsoleFont module in the PowerShell module folder in the Documents directory using the file name SetConsoleFont.psm1, like this:
Then, you can import the module with:
You can now get a list of the available fonts and their dimensions with:
Get-ConsoleFontInfo | Format-Table -AutoSize
To set a font size, you have to choose a number from the nFont column:
To change your font size to the default, you can run Set-ConsoleFont without an argument.