-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjdk17setup.ps1
More file actions
22 lines (17 loc) · 765 Bytes
/
jdk17setup.ps1
File metadata and controls
22 lines (17 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
$url = "https://download.oracle.com/java/17/archive/jdk-17.0.10_windows-x64_bin.exe"
$outputDirectory = Join-Path -Path $env:HOMEDRIVE -ChildPath $env:HOMEPATH
$outputDirectory = Join-Path -Path $outputDirectory -ChildPath "Downloads"
$outputFileName = Split-Path -Path $url -Leaf
$filePath = Join-Path -Path $outputDirectory -ChildPath $outputFileName
# Ensure the output directory exists
if (!(Test-Path $outputDirectory)) {
New-Item -ItemType Directory -Force -Path $outputDirectory
}
if (Test-Path -Path $filePath) {
Write-Output "File exists"
} else {
Write-Output "File does not exist. Download in progress"
Invoke-WebRequest -Uri $url -OutFile $filePath
}
Start-Process -FilePath $filePath -Wait
Read-Host -Prompt "Press Enter to continue"