1

I am working on a PowerShell command that updates all my apps with one click but I ran into a problem I stored the winget command inside a variable $upgradeResult the code was $upgradeResult=winget upgrade -u --id $($_.Id) --silent --accept-source-agreements I noticed that the code runs without displaying anything so I added Write-Host $upgradeResult but there is an issue with the output it shows like this

    -     \     |                                                                                                                               -     \     |                                                                                                                           No available upgrade found. No newer package versions are available from the configured sources.

I don't know why it shows these characters - \ | - \ |

I tried Invoke-Expression and I tried to add | Out-String after the code but nothing seems to work it still shows these random characters - \ | - \ |

Mujtaba
  • 11
  • 2

1 Answers1

0

You might want to try the Microsoft.WinGet.Client PowerShell module. It's still in preview, but you're going to get better output objects.

https://www.powershellgallery.com/packages/Microsoft.WinGet.Client/

Demitrius Nelon
  • 1,210
  • 1
  • 10
  • 29