Share this post:This blog post is part of an ongoing series by Adam Gordon. Adam will walk through each PowerShell command every week, explaining when and how to use them. Clear-Host is Adam’s topic this week.
Clear-Host: When should you use it?
Clear-Host removes all text from the current display. This includes any commands or output that may have been accumulated. It displays the command prompt once it is complete. You can use the function name, or its alias, “cls”
Clear-Host does not affect the current display. Clear-Host does not delete saved results, or remove items from the session. This function does not affect session-specific items such as variables or functions.
Clear-Host’s behavior is determined by the host software. Clear-Host may behave differently in different host applications.
What version of PowerShell should I use for this blog?
Get the PowerShell Version for your machine
$PSVersionTable
This command displays the PowerShell version information for your machine.
How to use Clear-Host
Clear-Host is a tool that can clear the display.
Clear-Host
Clear-Host is not an advanced function. It is a simple function. Clear-Host commands cannot contain common parameters such as -Debug.
Find out last week’s command GetHistory here.
Do you need PowerShell training? ITProTV offers PowerShell online IT training courses.