Merge pull request #149 from KnifMelti/main

Sort WingetPath as INT
pull/164/head
Romain 2022-09-08 15:15:07 +02:00 committed by GitHub
commit 406648bf85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@
Function Get-WingetCmd {
#Get WinGet Path (if admin context)
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" | Sort-Object { [version]($_.Path -replace '^[^\d]+_((\d+\.)*\d+)_.*', '$1') }
if ($ResolveWingetPath) {
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path