Quantcast
Channel: QuickTip – Jaap Brasser's Blog
Viewing all articles
Browse latest Browse all 18

QuickTip: Change PowerShell Console Size and Buffer

$
0
0

Changing the size of the PowerShell console is something that has been made easier in recent versions of PowerShell. But when working with older versions of PowerShell or with automated systems it is useful to be able to do this programmatically.

To set the buffer to 5000 lines and a line width of 160 characters we run the following code:

$host.UI.RawUI.BufferSize = New-Object System.Management.Automation.Host.Size(160,5000)

To determine the current width and buffer of the console we can check the following variable:

$host.UI.RawUI.BufferSize

Note that when you attempt to decrease the width to below the current width you will be presented with an error:

Share


Viewing all articles
Browse latest Browse all 18

Trending Articles