powershellubuntu

How to remove the progress bar from Remove-Item in PowerShell 7.5?


I have a PowerShell build script that deletes the previously built directory using Remove-Item. It works just fine, but since version 7.5 it produces a yellow progress bar as output that I don't want but can't seem to get rid of. Even worse, the last state of the progress bar remains on screen and only gets pushed down by new output. The cmdlet documentation doesn't mention a quiet mode or something similar, and piping the output to $null didn't help either. I'm using PowerShell 7.5 on Ubuntu.

This is the full line of the script:

Remove-Item -Recurse -Force $config.paths.folder

And here's how it looks (this line doesn't go away):

an image of the annoying little progress bar


Solution

  • You can suppress the progress output by setting the -ProgressAction common parameter. Alternatively, you can also set the $ProgressPreference variable if you want to suppress the progress output for all cmdlets.

    Remove-Item -Recurse -Force $config.paths.folder -ProgressAction SilentlyContinue