Merge pull request #40 from Romanitho/fix

Fix multiple Winget version cases
pull/41/head v1.7.1
Romain 2022-04-07 12:44:00 +02:00 committed by GitHub
commit 06f2cc0159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<app> <app>
<name>Winget-AutoUpdate (WAU)</name> <name>Winget-AutoUpdate (WAU)</name>
<version>1.7.0</version> <version>1.7.1</version>
<author>Romanitho</author> <author>Romanitho</author>
<info>https://github.com/Romanitho/Winget-AutoUpdate</info> <info>https://github.com/Romanitho/Winget-AutoUpdate</info>
</app> </app>

View File

@ -6,8 +6,13 @@ function Get-WingetOutdatedApps {
[string]$AvailableVersion [string]$AvailableVersion
} }
#Get WinGet Path #Get WinGet Path (if admin context)
$WingetPath = (Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe").Path $ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path
}
#Get Winget Location in User context #Get Winget Location in User context
if ($WingetCmd){ if ($WingetCmd){
$Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source $Script:Winget = (Get-Command winget.exe -ErrorAction SilentlyContinue).Source