Now I decided to write some exceptions lines to save the same CPU resources and not waste unnecessary executions.
So..
To skip java installation if the windows installer process is already doing some other things, I use:
setlocal EnableDelayedExpansion
tasklist | findstr "msiexec"
if !errorlevel!==0 echo another installation is in progress
if !errorlevel!==0 goto exit
.. executing installation
:exit
endlocalFor particular java version, I grow the program with some detection rule:setlocal EnableDelayedExpansion
set sw=HKLM\SOFTWARE
set u=Microsoft\Windows\CurrentVersion\Uninstall
set k={26A24AE4-039D-4CA4-87B4-2F32180131F0}
if not "%ProgramFiles(x86)%"=="" set x=Wow6432Node\
reg query "%sw%\%x%%u%\%k%" > nul 2>&1
if not !errorlevel!==0 (
.. do some installation
) else echo %k% already found
endlocal{26A24AE4-039D-4CA4-87B4-2F32180131F0} stands for JRE version 8u131And now the full code:
No comments:
Post a Comment