Thursday, September 3, 2020

Suppress Hash Marks in Compress-Archive and Expand-Archive

When using Compress-Archive and Expand-Archive in Powershell 5.0 and above, the scripts output a series of hashmarks to show progress. This can take up a lot of vertical screen real estate since each mark occupies its own line:

Compress-Archive -Path example_file.txt -DestinationPath example_file.zip -Force;
  #
  #
  #
  #
  #

To suppress these, redirect the information stream to null:

Compress-Archive -Path example_file.txt -DestinationPath example_file.zip -Force 6> $null;

and Enjoy the Silence

No comments:

Post a Comment