You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
482 B

4 years ago
param ($url, $targetDir)
$archiveFile="C:\TEMP\corretto-11-jdk.zip"
Write-Host ('Downloading {0} ...' -f $url)
(New-Object System.Net.WebClient).DownloadFile($url, $archiveFile)
Write-Host 'Installing ...'
tar -xf $archiveFile
# rename an unpacked directory like 'jdk11.0.10' to 'jdk11'
$jdkDir=Get-ChildItem -Filter "jdk11.*"|Select-Object -First 1
Rename-Item -Path $jdkDir.FullName -NewName $targetDir
Remove-Item $archiveFile -Force
Write-Host 'Installation is complete.'