Last active
April 22, 2023 10:55
-
-
Save Alistair1231/b1d09807524a7c76d9551359df8ad690 to your computer and use it in GitHub Desktop.
powershell script to get latest KMS_VL_ALL_AIO version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ######## | |
# # bash # | |
# ######## | |
# pattern="KMS_VL_ALL_AIO-.*.7z" | |
# repo="abbodi1406/KMS_VL_ALL_AIO" | |
# # remove old files | |
# rm -f description.txt && rm -f ATLauncher-*.jar | |
# # get the files | |
# curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -oP '"browser_download_url":\s*"\K[^"]+' | grep -E "$pattern" | wget -q --show-progress -i - | |
# # get the description | |
# curl -s "https://api.github.com/repos/$repo/releases/latest" | grep -oP '"body":\s*"\K[^"]+' | sed -e 's/\\r\\n/\n/g' -e 's/\\n/\n/g' -e 's/^[[:space:]]+//' | tr -d '```' > description.txt | |
############## | |
# powershell # | |
############## | |
$pattern="KMS_VL_ALL_AIO-.*.7z" | |
$repo="abbodi1406/KMS_VL_ALL_AIO" | |
# remove old files | |
if (Test-Path $pattern) { rm -Force $pattern } | |
if (Test-Path "description.txt") { rm -Force "description.txt" } | |
# get the files | |
(Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases/latest").assets.browser_download_url | | |
Select-String -Pattern $pattern | | |
ForEach-Object { | |
Invoke-WebRequest $($_ | Select-Object -ExpandProperty line) -OutFile $($_.Matches.Value.Split("/")[-1]) | |
} | |
# get the description | |
Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases/latest" | | |
Select-Object -ExpandProperty body | | |
ForEach-Object {$_ -replace '\\r\\n', "`n" -replace '^[[:space:]]+', '' -replace '```', ''} | | |
Set-Content -Path "description.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment