Some of the PowerShell commands in my script use progress bars, and those progress bars keep hanging around long after the command has finished. How do I get them to go away?
For example, save the following three lines as a .ps1 script, then run it from the command line. As the window scrolls from the directory listing, a ghost image of the progress bar from the completed command flashes in and out.
$ready = Read-Host "Press Return to Start. Press Control-C anytime to exit."
Test-NetConnection localhost
if ($?) { dir -Path C:\Windows -Recurse -File }
Picture of the ghost progress bar
What do I need to add between the Test-NetConnection
command and the dir
command that will make that ghost progress bar disappear?