Brief description of your issue
winget progress bars become line noise when redirecting to a file (in either cmd.exe or powershell) or when piping to tee or out-default (in powershell). I don't think there's a way to turn off the progress bar, so no way to avoid your terminal and log files getting spammed if you want to save output to a file.
Winget's internal logging functionality is not a solution to this issue. Consider a script that does many things, where running winget is just a small part. You often want to capture the entire output of the script, including the winget output, into a single log file. Having separate logfiles for all winget invocations doesn't really allow that. I often redirect the output of large powershell programs, which might invoke dozens of other scripts and executables along the way.
I guess there's two related issues here:
- The gibberish being produced on screen and in log files
- The inability to turn off the progress bar. Would be useful for fully-automated scenarios with logging.
Steps to reproduce
# Save output to log.txt but still display output in terminal
winget install -e Microsoft.PowerToys | tee log.txt
# Or just redirect to a file (cmd.exe _OR_ powershell/pwsh)
winget install -e Microsoft.PowerToys > log.txt
# Curiously, you get the same behavior with out-default, which is supposed to be a no-op
winget install -e Microsoft.PowerToys | Out-Default
Expected behavior
A pretty progress bar in the terminal and/or log files without pages of gibberish.
Actual behavior
ΓûêΓûêΓûêΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆ 9.00 MB / 83.2 MB
ΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆ 33.2 MB / 83.2 MB
ΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆΓûÆ 57.2 MB / 83.2 MB
ΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûÆ 81.2 MB / 83.2 MB
ΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûêΓûê 83.2 MB / 83.2 MB
If you are downloading a large file and/or have a slow connection, you can easily have many tens or even hundreds of these lines.
Environment
Windows Package Manager (Preview) v1.4.2161-preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.25217.1000
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.2161.0
Brief description of your issue
winget progress bars become line noise when redirecting to a file (in either cmd.exe or powershell) or when piping to
teeorout-default(in powershell). I don't think there's a way to turn off the progress bar, so no way to avoid your terminal and log files getting spammed if you want to save output to a file.Winget's internal logging functionality is not a solution to this issue. Consider a script that does many things, where running winget is just a small part. You often want to capture the entire output of the script, including the winget output, into a single log file. Having separate logfiles for all winget invocations doesn't really allow that. I often redirect the output of large powershell programs, which might invoke dozens of other scripts and executables along the way.
I guess there's two related issues here:
Steps to reproduce
Expected behavior
A pretty progress bar in the terminal and/or log files without pages of gibberish.
Actual behavior
If you are downloading a large file and/or have a slow connection, you can easily have many tens or even hundreds of these lines.
Environment