https://github.com/abbodi1406/vcredist/releases/download/v0.77.0/VisualCppRedist_AIO_x86_x64.exe
Invoke-WebRequest -Uri "https://github.com/abbodi1406/vcredist/releases/download/v0.78.0/VisualCppRedist_AIO_x86_x64.exe" -OutFile ".\VisualCppRedist_AIO_x86_x64.exe"
Start-Process -FilePath ".\VisualCppRedist_AIO_x86_x64.exe" -ArgumentList "/y" -Wait
Remove-Item -Path ".\VisualCppRedist_AIO_x86_x64.exe"
function Get-VersionsFromGitHub {
$url = "https://github.com/abbodi1406/vcredist/releases"
$response = Invoke-WebRequest -Uri $url
$versions = $response.Content | Select-String -Pattern "v\d+\.\d+\.\d+" -AllMatches | ForEach-Object { $_.Matches.Value }
return $versions
}
function Get-MaxVersion {
param (
[string[]]$versions
)
$maxVer = "v0.00.0"
foreach ($version in $versions) {
if ($version -match "v(\d{1,2})\.(\d{1,2})\.(\d{1,2})") {
$currentVer = "v$($matches[1]).$($matches[2]).$($matches[3])"
if ($currentVer -gt $maxVer) {
$maxVer = $currentVer
}
}
}
return $maxVer
}
$versions = Get-VersionsFromGitHub
$latestVersion = Get-MaxVersion -versions $versions
Write-Output "Max version product: $latestVersion"
Invoke-WebRequest -Uri "https://github.com/abbodi1406/vcredist/releases/download/$latestVersion/VisualCppRedist_AIO_x86_x64.exe" -OutFile ".\VisualCppRedist_AIO_x86_x64.exe"
Start-Process -FilePath ".\VisualCppRedist_AIO_x86_x64.exe" -ArgumentList "/y" -Wait
Remove-Item -Path ".\VisualCppRedist_AIO_x86_x64.exe"
pause
exit