Skip to content

Instantly share code, notes, and snippets.

@stefan-matic
Created September 7, 2020 07:32
Show Gist options
  • Save stefan-matic/26193034129794981f5627f6f86ae3ba to your computer and use it in GitHub Desktop.
Save stefan-matic/26193034129794981f5627f6f86ae3ba to your computer and use it in GitHub Desktop.
Download and Run Latest PowerToys Release
# Credits to MarkTiedemann for providing the original script and Splaxi for improving it
# https://gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3
$repo = "microsoft/PowerToys"
$filenamePattern = "*.msi"
$innerDirectory = $true
$preRelease = $false
if ($preRelease) {
$releasesUri = "https://api.github.com/repos/$repo/releases"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri)[0].assets | Where-Object name -like $filenamePattern ).browser_download_url
}
else {
$releasesUri = "https://api.github.com/repos/$repo/releases/latest"
$downloadUri = ((Invoke-RestMethod -Method GET -Uri $releasesUri).assets | Where-Object name -like $filenamePattern ).browser_download_url
}
$pathMSI = Join-Path -Path $([System.IO.Path]::GetTempPath()) -ChildPath $(Split-Path -Path $downloadUri -Leaf)
iwr -Uri $downloadUri -Out $pathMSI
Start-Process $pathMSI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment