Windows – How to reset windows powershell/command prompt, like reset in bash

cmd.execommand linepowershellvagrantwindows

When I use vagrant on Windows I will sometimes find that newlines aren't respected properly. This is typically after doing a vagrant ssh. So text ends up looking like

This machine with the name 'default' was not found 
                                                   configured for this environment.

In bash when this kind of terminal goofup happens I can run reset and it clears and resets the terminal settings. How can I do something similar in Powershell/CMD and not have to kill the window and start a new powershell/cmd session?

Best Answer

Use CLS in both the command prompt and PowerShell.

Note: In PowerShell, CLS is technically an alias of the command Clear-Host.

CLS Clear the screen - Windows CMD - SS64

Syntax: CLS

If CLS is redirected to file, console or executed through FOR /F it will print a line feed character (ASCII 10).

Errorlevels:
If the screen is successfully cleared %ERRORLEVEL% = unchanged (this is a bug) If a bad switch is given = 1

 

Clear-Host - PowerShell - SS64 Clear-Host

Clear the screen.

Syntax: Clear-Host

Standard Aliases for Clear-Host: clear, cls

Related Question