Skip to content

Instantly share code, notes, and snippets.

@BOAScripts
Created October 30, 2022 16:53
Show Gist options
  • Select an option

  • Save BOAScripts/31aafe092dbc6cee4d547d25c48e94fe to your computer and use it in GitHub Desktop.

Select an option

Save BOAScripts/31aafe092dbc6cee4d547d25c48e94fe to your computer and use it in GitHub Desktop.
Find id of latest Python version on winget
$Pythons3Search = winget search 'Python.3'
$PythonResults = $Pythons3Search[3..$Pythons3Search.Length]
[version]$ver ='3.0'
$node = ''
Foreach ($entry in $PythonResults) {
$entryVer = [version]$entry.replace(' ',';').split(';')[2]
$entryid = $entry.replace(' ',';').split(';')[1]
if ($ver -lt $entryVer ){
$ver = $entryVer
$node = $entryid
}
}
Write-Host $node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment