Is there a way to have the PowerShell screen clear itself before each command?

Know this is older, but thought I'd pass this along to anyone else looking -

One trick I use is to simply put "cls" as the first line in my PowerShell editor screen (in my case, using PowerShell ISE). Then each time I run my script, the PowerShell console within the ISE is cleared out, saving time so only my most recent run is shown there.

I'm not advising to leave "cls" in production scripts - but it is helpful for iterative testing within an ISE where you are constantly checking output in the PowerShell console window based on script input.


From this article: In PowerShell, in order to clear the screen you can either type Clear-Host;, its aliases, cls; and clear; or its equivalent [System.Console]::Clear();.