You could push the results of that command to another batch file and use the call
function to call those results and then iterate through those results using FOR
.
The code to output to another batch file would look like this:
where /r "c:\Program Files (x86)\Java" java.exe > path.bat
EDIT: The resulting path.bat file looks like this:
c:\Program Files (x86)\Java\jdk1.7.0\bin\java.exe
c:\Program Files (x86)\Java\jdk1.7.0\jre\bin\java.exe
c:\Program Files (x86)\Java\jdk1.7.0_51\bin\java.exe
c:\Program Files (x86)\Java\jdk1.7.0_51\jre\bin\java.exe
c:\Program Files (x86)\Java\jdk1.8.0_144\bin\java.exe
c:\Program Files (x86)\Java\jdk1.8.0_144\jre\bin\java.exe
c:\Program Files (x86)\Java\jdk1.8.0_181_32b\bin\java.exe
c:\Program Files (x86)\Java\jdk1.8.0_181_32b\jre\bin\java.exe
c:\Program Files (x86)\Java\jdk7\bin\java.exe
c:\Program Files (x86)\Java\jre1.8.0_144\bin\java.exe
c:\Program Files (x86)\Java\jre1.8.0_181\bin\java.exe