Powershell Clear-Host alternative to save buffer

I would like something like Clear-Host, but I would like to scroll.

So far, all I have is basically adding new lines until the screen becomes clear. Although, when I do this, the cursor starts writing at the bottom of the page (as you might expect, although not desirable).

I would like to start writing at the top of the page (for menus, etc., which is natural to do)

This is the code for printing a dynamic count of new lines:

do {Write-Host ""; $i++}
while ($i -ne $Host.UI.RawUI.WindowSize.Height)

I saw something about the Transcript module, but I do not wish it.

Thanks in advance.

+4
source share
1 answer

Here is a post that gives exactly what you are looking for:

http://tommymaynard.com/ql-clear-host-without-clearning-the-host/

+3

All Articles