Changes

Java

1,016 bytes added, 09:41, 19 May 2009
Uninstaller batch script
If you are just starting out with WPKG and want to be able to uninstall all versions of Java prior to your first package, you can use JavaRa (http://raproducts.org/javara.html) to silently uninstall all prior versions of the JRE.
 
There's also a scripting solution. It can also be used for other programs like Adobe Reader.
 
<source lang="dos">
@ECHO OFF
rem Find all programs installed on the computer
ECHO Finding all Java-installations...
FOR /f %%I IN ('REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall') DO ECHO %%I | FIND "{" > NUL && CALL :All-Installations %%I
ECHO Finished removing Java.
GOTO :EOF
 
:All-Installations
rem Filter out all but the Sun Installations
FOR /f "tokens=2*" %%T IN ('REG QUERY %1 /v Publisher 2^> NUL') DO ECHO Removing: %%U | FIND "Sun" > NUL && CALL :Sun-Installations %1
GOTO :EOF
:Sun-Installations
rem Filter out all but the Sun-Java Installations. Note the tilde + n, which drops all the subkeys from the path
FOR /f "tokens=2*" %%T IN ('REG QUERY %1 /v DisplayName 2^> NUL') DO ECHO Removing: %%U | FIND "Java" && CALL :Sun-Java-Installs %~n1
GOTO :EOF
:Sun-Java-Installs
rem Run uninstaller in unattended mode
START "" /WAIT "%WinDir%\SYSTEM32\msiexec.exe" /x%1 /qn
GOTO :EOF
</source>
See also [[Sun Java]]
3
edits