mirror of
https://github.com/msvc-win/get.msvc.win.git
synced 2025-12-15 12:47:40 +00:00
Update install routine
This commit is contained in:
parent
a7ffeac9db
commit
ae853df86b
4 changed files with 106 additions and 68 deletions
50
32
50
32
|
|
@ -11,6 +11,10 @@ function Main {
|
|||
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||
return 1
|
||||
}
|
||||
elseif ($procArch -eq 'ia64') {
|
||||
Write-Warning "This script does not support Itanium. Exiting..."
|
||||
return 1
|
||||
}
|
||||
|
||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||
|
|
@ -93,29 +97,33 @@ function Main {
|
|||
@{ Name = "vcredist_2015-2022_x86.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"; Year = "2015-2022" }
|
||||
)
|
||||
|
||||
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||
|
||||
# --- Download everything up front ---
|
||||
foreach ($item in $downloads) {
|
||||
$outFile = Join-Path $tempDir $item.Name
|
||||
Write-Host "Downloading $($item.Name)..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"`"$($item.Url)`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
}
|
||||
$line = "$($item.Url)`n out=$($item.Name)"
|
||||
Add-Content -Path $ariaListPath -Value $line
|
||||
}
|
||||
|
||||
Write-Host "Downloading files..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"-i `"$ariaListPath`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
# --- Check Signature ---
|
||||
|
|
|
|||
53
64
53
64
|
|
@ -19,6 +19,10 @@ function Main {
|
|||
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||
return 1
|
||||
}
|
||||
elseif ($procArch -eq 'ia64') {
|
||||
Write-Warning "This script does not support Itanium. Exiting..."
|
||||
return 1
|
||||
}
|
||||
|
||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||
|
|
@ -111,32 +115,33 @@ function Main {
|
|||
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
||||
}
|
||||
|
||||
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||
|
||||
# --- Download everything up front ---
|
||||
foreach ($item in $downloads) {
|
||||
if ($item.Name -Match "x64" -and $procArch -eq 'ARM64' -and $buildVersion -lt 22000) {
|
||||
continue
|
||||
}
|
||||
$outFile = Join-Path $tempDir $item.Name
|
||||
Write-Host "Downloading $($item.Name)..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"`"$($item.Url)`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
}
|
||||
$line = "$($item.Url)`n out=$($item.Name)"
|
||||
Add-Content -Path $ariaListPath -Value $line
|
||||
}
|
||||
|
||||
Write-Host "Downloading files..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"-i `"$ariaListPath`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
# --- Check Signature ---
|
||||
|
|
|
|||
4
dx
4
dx
|
|
@ -11,6 +11,10 @@ function Main {
|
|||
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||
return 1
|
||||
}
|
||||
elseif ($procArch -eq 'ia64') {
|
||||
Write-Warning "This script does not support Itanium. Exiting..."
|
||||
return 1
|
||||
}
|
||||
|
||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||
|
|
|
|||
67
index.html
67
index.html
|
|
@ -10,11 +10,16 @@ function Main {
|
|||
}
|
||||
|
||||
$procArch = $Env:PROCESSOR_ARCHITECTURE
|
||||
$isServer = (Get-CimInstance Win32_OperatingSystem).ProductType -ne 1
|
||||
$buildVersion = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').CurrentBuild
|
||||
if ($procArch -eq 'ARM') {
|
||||
Write-Warning "This script does not support Windows RT. Exiting..."
|
||||
return 1
|
||||
}
|
||||
elseif ($procArch -eq 'ia64') {
|
||||
Write-Warning "This script does not support Itanium. Exiting..."
|
||||
return 1
|
||||
}
|
||||
|
||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||
if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue }
|
||||
|
|
@ -40,6 +45,13 @@ function Main {
|
|||
}
|
||||
}
|
||||
|
||||
if ($isServer) {
|
||||
Write-Warning "Windows Server detected, DirectX will not be installed. To install it anyway, execute following command:"
|
||||
Write-Host "irm https://get.msvc.win/dx | iex"
|
||||
Write-Host "This script will continue in 10 seconds..."
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
|
||||
# --- Elevated section ---
|
||||
New-Item -Path $flagPath -ItemType File -Force | Out-Null
|
||||
Write-Host "Running with elevated privileges..."
|
||||
|
|
@ -110,32 +122,39 @@ function Main {
|
|||
$downloads += @{ Name = "vcredist_2015-2022_arm64.exe"; Url = "https://aka.ms/vs/17/release/vc_redist.arm64.exe"; Year = "2012-2022" }
|
||||
}
|
||||
|
||||
$ariaListPath = Join-Path $tempDir "fileList.txt"
|
||||
|
||||
# --- Download everything up front ---
|
||||
foreach ($item in $downloads) {
|
||||
if ($item.Name -Match "x64" -and $procArch -ne "AMD64" -and $buildVersion -lt 22000) {
|
||||
continue
|
||||
}
|
||||
$outFile = Join-Path $tempDir $item.Name
|
||||
Write-Host "Downloading $($item.Name)..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"`"$($item.Url)`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
if ($item.Name -Match "directx" -and $isServer) {
|
||||
continue
|
||||
}
|
||||
$line = "$($item.Url)`n out=$($item.Name)"
|
||||
Add-Content -Path $ariaListPath -Value $line
|
||||
}
|
||||
|
||||
Write-Host "Downloading files..."
|
||||
$argumentList = @(
|
||||
"--dir=`"$($outFile | Split-Path)`"",
|
||||
"--out=`"$(Split-Path -Leaf $outFile)`"",
|
||||
"--allow-overwrite=true",
|
||||
"--retry-wait=5",
|
||||
"--max-connection-per-server=8",
|
||||
"--split=8",
|
||||
"--min-split-size=1M",
|
||||
"-i `"$ariaListPath`""
|
||||
)
|
||||
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
|
||||
$argumentList += $regionalWorkaround
|
||||
}
|
||||
$proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -PassThru -Wait
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..."
|
||||
$argsRetry = $argumentList + "--check-certificate=false"
|
||||
Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
# --- Check Signature ---
|
||||
|
|
@ -172,9 +191,11 @@ function Main {
|
|||
}
|
||||
|
||||
# --- Install DirectX ---
|
||||
Write-Host "Installing DirectX..."
|
||||
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
||||
Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -Wait
|
||||
if (-not $isServer) {
|
||||
Write-Host "Installing DirectX..."
|
||||
Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait
|
||||
Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -Wait
|
||||
}
|
||||
|
||||
# --- Install VC++ Redistributables ---
|
||||
foreach ($item in $downloads | Where-Object { $_.Name -like "vcredist*" }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue