chelo32 Posted November 21, 2013 Share Posted November 21, 2013 I would like to tranform this code I found on the web autoitIt is written in batch, and the truth is very good and practicalIf anyone has any idea I leave the codeSorry for my bad English expandcollapse popup@echo off setlocal enableextensions enabledelayedexpansion color 17 title Java removal/update tool v0.9 echo. echo This software is brought to you by Grintor. echo ^<Grintor at Gmail dot Com^> echo. echo This program is free software. echo This program IS PROVIDED WITHOUT WARRANTY, EITHER EXPRESSED OR IMPLIED. echo This program is copyrighted under the terms of GPLv3: echo see ^<http://www.gnu.org/licenses/^>. echo. echo This program uses cURL, also free software, source code available: echo see ^<http://curl.haxx.se/^>. echo. echo This binary is also a compressed package. echo The source code is available within. echo It can be decompressed using 7-zip, also free software: echo see ^<http://www.7-zip.org/^>. echo. FOR /L %%n IN (1,1,10) DO ping -n 2 127.0.0.1 > nul & <nul set /p =. cls echo. echo Searching for latest version of Java... ping -n 1 google.com > nul || goto error ::----------- Find the latest java version---------------------------------- FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L http://javadl-esd.sun.com/update/1.7.0/map-m-1.7.0.xml ^| find /i "https:"') DO set URL1=%%n FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L -k %URL1% ^| find /i "<version>"') DO set RemoteJavaVersion=%%n set RemoteJavaVersion=%RemoteJavaVersion:~0,8% echo The latest version of java is %RemoteJavaVersion%. ::----------- Find the local Java version----------------------------------- set LocalJavaVersion=None FOR /F "tokens=1-15" %%n IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s ^& reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s 2^> nul') DO ( if '%%n'=='InstallSource' ( set p=%%p%%q%%r%%s%%t%%u%%v%%w%%x%%y%%z set p=!p: =\! set p=!p:\= ! for %%n in (!p!) do set c=%%n ) if '%%n'=='DisplayName' ( set p=%%p if "!p:~0,4!"=="Java" if not "%%q"=="Auto" if not '!LocalJavaVersion!'=='None' (set LocalJavaVersion=Multi) ELSE (set LocalJavaVersion=!c:~3!) if "!p:~0,4!"=="J2SE" if not '!LocalJavaVersion!'=='None' (set LocalJavaVersion=Multi) ELSE (set LocalJavaVersion=!c:~3!) ) ) if '%LocalJavaVersion%'=='None' echo There is no local version of Java. & goto install if '%LocalJavaVersion%'=='Multi' echo There are multiple local versions of Java installed. & goto uninstall echo The local version of Java is %LocalJavaVersion%. ::----------- If they match, skip to the end--------------------------------- if '%RemoteJavaVersion%'=='%LocalJavaVersion%' (goto finished) ELSE (echo The Local version of Java is out of date.) ::----------- Uninstall all currently installed java versions---------------- :uninstall if '%LocalJavaVersion%'=='Multi' (echo Uninstalling all local versions of Java...) ELSE (echo Uninstalling the local version of Java...) FOR /F "tokens=1-4" %%n IN ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s ^& reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall /s 2^> nul') DO ( if '%%n'=='UninstallString' ( set c=%%q set c=!c:/I=/X! ) if '%%n'=='DisplayName' ( set d=%%p if "!d:~0,4!"=="Java" if not "%%q"=="Auto" msiexec.exe !c! /qn & ping -n 11 127.0.0.1 > nul if "!d:~0,4!"=="J2SE" msiexec.exe !c! /qn & ping -n 11 127.0.0.1 > nul ) ) ::----------- Download the latest java, install, delete the installer.------- :install echo Downloading latest version of Java... FOR /F "tokens=2 delims=<> " %%n IN ('curl.exe -s -L -k %url1% ^| find /i ".exe"') DO set url2=%%n curl.exe -s -L -k -o java.exe %url2% echo Installing latest version of Java... start /wait java.exe /s ping 127.0.0.1 > nul del java.exe ::----------- Up to date ---------------------------------------------------- :finished echo Your Java is up to date. echo. ::----------- There was an error--------------------------------------------- goto noerror :error echo There was a network error. Please try again. :noerror FOR /L %%n IN (1,1,10) DO ping -n 2 127.0.0.1 > nul & <nul set /p =. http://downloads.sourceforge.net/project/autojavaupdater/java%20tool.exe?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fautojavaupdater%2F&ts=1385042371&use_mirror=ufpr Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 21, 2013 Moderators Share Posted November 21, 2013 It looks very doable in autoit. But what have you tried yourself? This is not a forum where you tell people what you want and we barf up code for you, you have to show a little effort "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
l3ill Posted November 21, 2013 Share Posted November 21, 2013 (edited) LOL we barf up code ~~~~~~ aawww didn't that icon used to actually barf? Edit: ~~~~~~ There ya gewww... (cartman's voice) Edited November 22, 2013 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 21, 2013 Moderators Share Posted November 21, 2013 billo,You mean like this: M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
l3ill Posted November 21, 2013 Share Posted November 21, 2013 Yeah thats the one the green one just looks like he's gonna get his lunch on'im My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
gruntydatsun Posted November 22, 2013 Share Posted November 22, 2013 you can find installed versions of java for 32bit windows 7 here. Google for the 64 bits one HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment use this command to return the full path to all instances of javaw.exe on your machine. note that it's only recursively searching below the current directory so start it in the root of the drive you're searching dir /s /b java.exe this runs fast on my machine. two instances of java.exe returned and the search took about a second on an ssd you can run the returned executable with the -v switch to get the version number for that instance. this should be enough basic tools to do the job. there's a much easier way to do it though, use NiNite and it'll check for updates, download and install without the optional rapeware being installed. Just lives as a single exe on your machine. Makes my life easy as it updates 90% of the apps I use everyday with a single click of a single executable file, no installation required. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now