title: How to remove empty row and "()" output from Java version check script
body: <p>I have a windows command line script to run to check the <a href="https://stackoverflow.com/questions/5675459/how-to-get-java-version-from-batch-script">java version</a>, but it is outputting two additional rows(2 &amp; 3) I don't need.  I need it only to display the Echo of Current Java Version and the Java version number(1 &amp; 3).  Can you possibly assist with how I can modify the script?</p>
  
  <ol>
  <li>Current Java Version</li>
  <li>empty row </li>
  <li>C:\Program Files \Java|jre7\bin>()</li>
  <li>"1.7.0_161" </li>
  </ol>
  
  <p><strong>Command being used:</strong></p>
  
  <pre><code>C:\Windows\system32\cmd.exe /c echo Current Java Version &amp; C:\Windows\system32\cmd.exe /c  "for /f "tokens=3" %g in ('java -version 2^&gt;^&amp;1 ^| findstr /i "version"') do (@echo %g)"
  </code></pre>
  
  <p><strong>Output from cmd window:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/tvnAD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tvnAD.jpg" alt="cmd_window"></a></p>