I found the attached script (uninstall_java.cmd) which seems to do a good job 
of uninstalling all previous versions of Java in a more efficient way.

I modified it a bit so I could more easily reuse if for other apps such as 
Adobe Reader (uninstall_reader.cmd).

Andrew


-----Original Message-----
From: wpkg-users-boun...@lists.wpkg.org 
[mailto:wpkg-users-boun...@lists.wpkg.org] On Behalf Of Daniel Dehennin
Sent: Wednesday, May 26, 2010 6:58 AM
To: wpkg-users@lists.wpkg.org
Subject: Re: [wpkg-users] Java hanging on install

Troy Hamilton <troy.a.hamil...@gmail.com> writes:

> Daniel,
>
> I had the exact same problem until I explicitly killed jqs.exe before 
> trying to uninstall the old versions.  Like Marc suggested, this is 
> the first command that I run:
>
> taskkill /f /im jqs.exe /im iexplore.exe /im firefox.exe

WPKG client is run when the computer is shutdown, so iexplore and firefox are 
(should?) be down, I use:

REM Stop Quick Starter service if any
net STOP JavaQuickStarterService 2> NUL > NUL

echo Disable "Java Quick Starter"
"%ProgramFiles%\Java\jre6\bin\jqs.exe" -unregister

Before running msiexec calls...

I'll test the output redirections to see if there is an improvement, and then 
add the taskkill.

I'll finally understand what's happenning ;-)

Thanks.
--
Daniel Dehennin
RAIP de l'Orne
@echo off & cls
REM http://forums.sun.com/thread.jspa?threadID=692662

set EXIT_CODE=0

set DEBUGFILE=c:\uninstall_java.log
rem set DEBUGFILE=NUL
date /t > %DEBUGFILE%
time /t >> %DEBUGFILE%

taskkill /F /IM jqs.exe >> %DEBUGFILE%

Rem List all Installation subkeys from uninstall key.
echo Searching Registry for Java Installs >> %DEBUGFILE%
for /f %%I in ('reg query 
HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find 
"{" > nul && call :All-Installations %%I
echo Search Complete.. >> %DEBUGFILE%
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 %%U | 
find "Sun" > nul && call :Sun-Installations %1
goto :EOF
:Sun-Installations
Rem Filter out all but the Sun-Java Installations. Note the tilda + n, which 
drops all the subkeys from the path
for /f "tokens=2*" %%T in ('reg query %1 /v DisplayName 2^> nul') do echo . 
Uninstalling - %%U: | find "Java" && call :Sun-Java-Installs %~n1
goto :EOF
:Sun-Java-Installs
Rem Run Uninstaller for the installation
MsiExec.exe /x%1 /qn /norestart
echo . Uninstall Complete, Resuming Search.. >> %DEBUGFILE%
goto :EOF

:EOF
exit /B %EXIT_CODE%
@echo off & cls
REM based on http://forums.sun.com/thread.jspa?threadID=692662

set EXIT_CODE=0
set PUBLISHER=Adobe Systems
set DISPLAYNAME=Adobe Reader

set DEBUGFILE=c:\uninstall_reader.log
rem set DEBUGFILE=NUL
date /t > %DEBUGFILE%
time /t >> %DEBUGFILE%

taskkill /F /IM AcroRd32.exe /IM AdobeUpdater.exe >> %DEBUGFILE%

Rem List all Installation subkeys from uninstall key.
echo Searching Registry for %DISPLAYNAME% by %PUBLISHER% >> %DEBUGFILE%
for /f %%I in ('reg query 
HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find 
"{" > nul && call :Publisher %%I
echo Search Complete.. >> %DEBUGFILE%
goto :EOF
:Publisher
Rem Filter out all except matches of given Publisher
for /f "tokens=2*" %%T in ('reg query %1 /v Publisher 2^> nul') do echo %%U | 
find "%PUBLISHER%" > nul && call :DisplayName %1
goto :EOF
:DisplayName
Rem Filter out all except matches of given DisplayName. Note the tilda + n, 
which drops all the subkeys from the path
for /f "tokens=2*" %%T in ('reg query %1 /v DisplayName 2^> nul') do echo . 
Uninstalling - %%U: | find "%DISPLAYNAME%" && call :Uninstall %~n1
goto :EOF
:Uninstall
Rem Run Uninstaller for the installation
echo attempting to uninstall %1 >> %DEBUGFILE%
MsiExec.exe /x%1 /qn /norestart
echo . Uninstall Complete, Resuming Search.. >> %DEBUGFILE%
goto :EOF

:EOF
exit /B %EXIT_CODE%
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users

Reply via email to