mirror of
https://github.com/msvc-win/get.msvc.win.git
synced 2025-12-16 21:27:39 +00:00
do not exit entire script
This commit is contained in:
parent
4ada8f2fde
commit
a238ee84d2
4 changed files with 392 additions and 368 deletions
16
32
16
32
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
function Main {
|
||||||
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
||||||
Write-Warning "Please run it on Windows. "
|
Write-Warning "Please run it on Windows. "
|
||||||
exit 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
|
|
@ -23,11 +24,12 @@ if (-not $IsAdmin) {
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
if (-Not (Test-Path $flagPath)) {
|
if (-Not (Test-Path $flagPath)) {
|
||||||
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
||||||
exit 1
|
return 1
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
||||||
Write-Host "Setup ran successfully."
|
Write-Host "Setup ran successfully."
|
||||||
exit 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,8 @@ if (-not (Test-Path $aria2Exe)) {
|
||||||
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
||||||
if ($countryCode -eq 'CN') {
|
if ($countryCode -eq 'CN') {
|
||||||
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
|
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
|
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
||||||
|
|
@ -104,3 +107,6 @@ Write-Host "Cleaning up temporary files..."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Main
|
||||||
16
64
16
64
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
function Main {
|
||||||
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
||||||
Write-Warning "Please run it on Windows. "
|
Write-Warning "Please run it on Windows. "
|
||||||
exit 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
|
|
@ -23,11 +24,12 @@ if (-not $IsAdmin) {
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
if (-Not (Test-Path $flagPath)) {
|
if (-Not (Test-Path $flagPath)) {
|
||||||
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
||||||
exit 1
|
return 1
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
||||||
Write-Host "Setup ran successfully."
|
Write-Host "Setup ran successfully."
|
||||||
exit 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,8 @@ if (-not (Test-Path $aria2Exe)) {
|
||||||
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
||||||
if ($countryCode -eq 'CN') {
|
if ($countryCode -eq 'CN') {
|
||||||
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
|
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
||||||
|
|
@ -104,3 +107,6 @@ Write-Host "Cleaning up temporary files..."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Main
|
||||||
16
dx
16
dx
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
function Main {
|
||||||
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
||||||
Write-Warning "Please run it on Windows. "
|
Write-Warning "Please run it on Windows. "
|
||||||
exit 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
|
|
@ -23,11 +24,12 @@ if (-not $IsAdmin) {
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
if (-Not (Test-Path $flagPath)) {
|
if (-Not (Test-Path $flagPath)) {
|
||||||
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
||||||
exit 1
|
return 1
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
||||||
Write-Host "Setup ran successfully."
|
Write-Host "Setup ran successfully."
|
||||||
exit 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,8 @@ if (-not (Test-Path $aria2Exe)) {
|
||||||
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
||||||
if ($countryCode -eq 'CN') {
|
if ($countryCode -eq 'CN') {
|
||||||
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
|
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip"
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
|
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-build1.zip"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
||||||
|
|
@ -90,3 +93,6 @@ Write-Host "Cleaning up temporary files..."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Main
|
||||||
16
index.html
16
index.html
|
|
@ -3,9 +3,10 @@
|
||||||
|
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
|
|
||||||
|
function Main {
|
||||||
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
if ($PSVersionTable.PSEdition -ne 'Desktop' -and $env:OS -ne 'Windows_NT') {
|
||||||
Write-Warning "Please run it on Windows. "
|
Write-Warning "Please run it on Windows. "
|
||||||
exit 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
$flagPath = "$env:TEMP\elevation_success.flag"
|
$flagPath = "$env:TEMP\elevation_success.flag"
|
||||||
|
|
@ -23,11 +24,12 @@ if (-not $IsAdmin) {
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
if (-Not (Test-Path $flagPath)) {
|
if (-Not (Test-Path $flagPath)) {
|
||||||
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
Write-Warning "User did not confirm UAC prompt or something went wrong."
|
||||||
exit 1
|
return 1
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
Remove-Item $flagPath -ErrorAction SilentlyContinue
|
||||||
Write-Host "Setup ran successfully."
|
Write-Host "Setup ran successfully."
|
||||||
exit 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -50,7 +52,8 @@ if (-not (Test-Path $aria2Exe)) {
|
||||||
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
||||||
if ($countryCode -eq 'CN') {
|
if ($countryCode -eq 'CN') {
|
||||||
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
|
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||||
}
|
}
|
||||||
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
||||||
|
|
@ -110,3 +113,6 @@ Write-Host "Cleaning up temporary files..."
|
||||||
Start-Sleep -Seconds 2
|
Start-Sleep -Seconds 2
|
||||||
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
|
||||||
|
Main
|
||||||
Loading…
Add table
Add a link
Reference in a new issue