吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1704|回复: 1
收起左侧

[Java 转载] 运维请看 - 20号Java SE 8 刚更新,分享个安装JDK的powershell脚本

[复制链接]
dummyking 发表于 2021-7-22 20:15
https://www.java.com/releases/
基本上就是装 8u301,删所有旧版本,请小心使用

[PowerShell] 纯文本查看 复制代码
# PowerShell script to automatically download and install the latest Java SE (JDK) version 8u301
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# Download and install Offline Java installer
$uri = "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=245045_d3c52aa6bfa54d3ca74e617f18309292"
$path = "$PSScriptRoot\jdk8_x64.exe"
(New-Object System.Net.WebClient).DownloadFile($uri, $path)
Start-Process $PSScriptRoot\jdk8_x64.exe '/s REBOOT=0 SPONSORS=0 AUTO_UPDATE=0' -wait
echo $?

$RegUninstallPaths = @(
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',
    'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall'
)

# Stop running Java process
Get-CimInstance -ClassName 'Win32_Process' | Where-Object {$_.ExecutablePath -like '*Program Files\Java*'} | Select-Object @{n='Name';e={$_.Name.Split('.')[0]}} | Stop-Process -Force
$VersionsToKeep = '8 Update 301'
$UninstallSearchFilter = {($_.GetValue('DisplayName') -like 'Java*') -and ($_.GetValue('Publisher') -like 'Oracle*') -and ($_.GetValue('DisplayName') -notlike "*$VersionsToKeep*")}

# Uninstall all older Java versions (incl. Auto Updater)
foreach ($Path in $RegUninstallPaths) {
    if (Test-Path $Path) {
        Get-ChildItem $Path | Where-Object $UninstallSearchFilter | foreach {
            Write-Host Uninstalling $_.GetValue('DisplayName') ...
            Start-Process 'C:\Windows\System32\msiexec.exe' "/X$($_.PSChildName) /qn /norestart" -Wait
        }
    }
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Tinaliasd 发表于 2021-11-29 23:46
大佬求一下go+python 双语言混合开发的sql文件
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-9 07:30

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表