I want to take this command
To upgrade an existing GYB install, run: bash <(curl -s -S -L ) -l The -l at the end tells the download script to upgrade to latest version and not perform the project setup steps. This will preserve your current settings and existing backups. and make it something that work in windows PowerShell.
The end goal is to make a windows script that updates to the latest release of a program called GYB automatically.
I don't have any code to offer since I don't have any good ideas to accomplish what I want.
Any help would be appreciated.
52 Answers
Rather than using their bash script, just downloading the latest file with that name from github with powershell worked ok for me.
$repo = "GAM-team/got-your-back" $releases = "" Write-Host Determining latest release $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name $file = "gyb-$($tag.Replace('v',''))-windows-x86_64.msi" #filename happens to have tag without the v prefix, this could probably be improved by someone who knows github better $download = "" Write-Host Dowloading latest release Invoke-WebRequest $download -Out $file #saves to current path, you probably want to specify folder here This is what I did. Thanks to the answer above.
$repo = "GAM-team/got-your-back" $releases = "" $InstalledGYB = 'v' + (& C:\gyb\gyb.exe --short-version) Write-Host "Determining latest release" -ForegroundColor Yellow $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name $CurrentRelease = "gyb-$($tag.Replace('v',''))-windows-x86_64.msi" #filename happens to have tag without the v prefix, this could probably be improved by someone who knows github better If ($InstalledGYB -ne $Tag) { $download = "" Write-Host "Dowloading latest release" -ForegroundColor Yellow Invoke-WebRequest $download -OutFile "C:\GYB\$CurrentRelease" Start-Process -Filepath "C:\GYB\$CurrentRelease" -ArgumentList "/passive" -Wait | Wait-Process -Timeout 60 Remove-Item "C:\GYB\$CurrentReleasea" -Force -ErrorAction SilentlyContinue } Else { Write-Host "GYB Current" -ForegroundColor Green }