Skip to content

Instantly share code, notes, and snippets.

@drichardson
Last active November 18, 2021 23:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drichardson/195db36121cf4de10be03c9fc1198b63 to your computer and use it in GitHub Desktop.
Save drichardson/195db36121cf4de10be03c9fc1198b63 to your computer and use it in GitHub Desktop.
Powershell Reset - Remove horizontal scrollbar and clear
function reset {
Set-Buffer-Width-To-Screen-Width
Clear-Host
}
function Set-Buffer-Width-To-Screen-Width {
$h = Get-Host
$ui = $h.UI.RawUI
$bufferSize = $ui.BufferSize
$windowSize = $ui.WindowSize
$bufferSize.Width = $windowSize.Width
$ui.BufferSize = $bufferSize
}
@PiepsC
Copy link

PiepsC commented Mar 28, 2020

Needless to say one needs to add bufferSize.Height = windowsize.Height to also remove the vertical scrollbar.

Thanks for the advice champ. Makes my shell look an awful lot prettier and neater.

@risingearly
Copy link

Thanks for writing out this workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment