简体   繁体   中英

windows powershell command to uninstall all versions of java except a specific version

Windows powershell command to uninstall all versions of Java except a specific version. This command should work in windows 7 & above.

The following command uninstalls all versions. How do I modify the following in such a way that a specific version 8.0.770.3 does not uninstall.

gwmi Win32_Product -filter "name like 'Java%' AND vendor like 'Oracle%' AND (version like '[78].%' OR version like '1.[78].%')" | % { $_.Uninstall() }

Change the filtering of version.

gwmi Win32_Product -filter "name like 'Java%' AND vendor like 'Oracle%' AND
not version = '8.0.770.3'" | % { $_.Uninstall() }

simplest powershell script

gwmi Win32_Product -filter "name like 'Java%'" | % { $_.Uninstall() }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM