将 bash 命令转换为 windows 支持 powershell 的命令
convert a bash command into a windows powershell capable command
我要接受这个命令
To upgrade an existing GYB install, run:
bash <(curl -s -S -L https://git.io/gyb-install) -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.
并让它在 windows PowerShell 中工作。
最终目标是制作一个 windows 脚本来更新到名为 GYB 的程序的最新版本
https://github.com/GAM-team/got-your-back/releases
自动。
我没有任何代码可以提供,因为我没有任何好的想法来完成我想要的。
如有任何帮助,我们将不胜感激。
与其使用他们的 bash 脚本,仅使用 powershell 从 github 下载具有该名称的最新文件对我来说没问题。
试试这个(原创于https://gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3)
$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/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 = "https://github.com/$repo/releases/download/$tag/$file"
Write-Host Dowloading latest release
Invoke-WebRequest $download -Out $file #saves to current path, you probably want to specify folder here
这就是我所做的。感谢楼上的回答。
$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/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 = "https://github.com/$repo/releases/download/$tag/$CurrentRelease"
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
}
我要接受这个命令
To upgrade an existing GYB install, run:
bash <(curl -s -S -L https://git.io/gyb-install) -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.
并让它在 windows PowerShell 中工作。
最终目标是制作一个 windows 脚本来更新到名为 GYB 的程序的最新版本 https://github.com/GAM-team/got-your-back/releases 自动。
我没有任何代码可以提供,因为我没有任何好的想法来完成我想要的。
如有任何帮助,我们将不胜感激。
与其使用他们的 bash 脚本,仅使用 powershell 从 github 下载具有该名称的最新文件对我来说没问题。
试试这个(原创于https://gist.github.com/MarkTiedemann/c0adc1701f3f5c215fc2c2d5b1d5efd3)
$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/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 = "https://github.com/$repo/releases/download/$tag/$file"
Write-Host Dowloading latest release
Invoke-WebRequest $download -Out $file #saves to current path, you probably want to specify folder here
这就是我所做的。感谢楼上的回答。
$repo = "GAM-team/got-your-back"
$releases = "https://api.github.com/repos/$repo/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 = "https://github.com/$repo/releases/download/$tag/$CurrentRelease"
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
}