How to use the command 'Clear-Host' (with examples)
The ‘Clear-Host’ command is used to clear the screen in PowerShell. It is primarily used to remove all the previous output and provide a clean working environment. This command can only be used through PowerShell and it is executed by typing ‘Clear-Host’ in the command prompt.
Use case 1: Clear the screen
Code:
Clear-Host
Motivation: The main motivation for using this command is to clear the screen and remove all the previous output. This provides a clean working environment and makes it easier to focus on the current task.
Explanation: There are no arguments required for the ‘Clear-Host’ command. It simply clears the screen and removes all the previous output.
Example output: Before executing the command:
Hello, World!
After executing the command:
<blank screen>
Conclusion: The ‘Clear-Host’ command is a simple and useful command for clearing the screen and removing all the previous output in PowerShell. It can be used to provide a clean working environment and make it easier to focus on the current task.