![]() To set a font size, you have to choose a number from the nFont column: Set-ConsoleFont 8 You can now get a list of the available fonts and their dimensions with: Get-ConsoleFontInfo | Format-Table -AutoSize Then, you can import the module with: Import-Module SetConsoleFont 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: %USERPROFILE%\Documents\WindowsPowerShell\Modules\SetConsoleFont\SetConsoleFont.psm1 With $env:PSModulePath on a PowerShell console, you can get a list of your module folders. Next, you have to store the file in your module folder. Make sure that the last line of the module looks like this: Export-ModuleMember -Variable _DefaultFont, _hConsoleScreen -Function Set-ConsoleFont, Get-ConsoleFontInfo Note that when I copied the text, the last line had an unwanted line break. First, copy the module to a local editor. ![]() Before you can use the Set-ConsoleFont cmdlet, you have to import the module. ![]() This is where the SetConsoleFont module comes in. 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. Number one is that it involves click-click, which any real PowerShell geek will avoid at all costs.
0 Comments
Leave a Reply. |