I have a windows command line script to run to check the java version, but it is outputting two additional rows(2 & 3) I don't need. I need it only to display the Echo of Current Java Version and the Java version number(1 & 3). Can you possibly assist with how I can modify the script?
- Current Java Version
- empty row
- C:\Program Files \Java|jre7\bin>()
- "1.7.0_161"
Command being used:
C:\Windows\system32\cmd.exe /c echo Current Java Version & C:\Windows\system32\cmd.exe /c "for /f "tokens=3" %g in ('java -version 2^>^&1 ^| findstr /i "version"') do (@echo %g)"
Output from cmd window: