optimize download without progressbar

This commit is contained in:
Baipyrus 2024-11-25 11:35:19 +01:00
parent 4ce997d016
commit 1d33d6ed32

View File

@ -1,5 +1,6 @@
function InstallWinget function InstallWinget
{ {
$progressPreference = 'silentlyContinue'
$download = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest' $download = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
$setup = "$env:TMP\winget_setup.msixbundle" $setup = "$env:TMP\winget_setup.msixbundle"
@ -9,9 +10,12 @@ function InstallWinget
$assets = $releases | Select-Object -ExpandProperty "assets" $assets = $releases | Select-Object -ExpandProperty "assets"
$installer = $assets | Where-Object "name" -Match "msixbundle" $installer = $assets | Where-Object "name" -Match "msixbundle"
$url = $installer | Select-Object -ExpandProperty "browser_download_url" $url = $installer | Select-Object -ExpandProperty "browser_download_url"
Invoke-RestMethod $url -OutFile $setup
Write-Host "Downloading WinGet '.msixbundle' installer ..."
Invoke-WebRequest $url -OutFile $setup
} }
Write-Host "Installing WinGet app package ..."
Add-AppxPackage -Path $setup Add-AppxPackage -Path $setup
} }