title: Script to check Flash version isn't really checking version
body: <p>I need some help making the following work. It's worked before (with other software), but in the case of Flash, it isn't. What I'm trying to accomplish is checking the installed version of Flash. If the installed version of Flash isn't what I want, I want the script to uninstall the current version and install my desired version.</p>
  
  <pre><code>:: Check Flash version and install if not matching.
  
  :: Set version to check for.
  
  SET latestVersion=11.5.502.135
  SET key="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Adobe  Flash Player Plugin"
  
  for /f "tokens=3 delims=    " %%G in ('reg query %key% /v DisplayVersion ^| findstr /i current') do (
  echo %%G
  if %%G EQU %latestVersion% goto END
  if %%G NEQ %latestVersion% goto Install
  )
  
  :INSTALL
  :: Kill IE &amp; FF
  taskkill /f /im iexplore.exe /im firefox.exe
  
  ::Uninstall Flash
  \\path-to-server\Flash-FF-11.8.800.94.exe -uninstall
  
  :: Install Flash for Firefox
  \\path-to-server\Flash-FF-11.5.502.135.exe -install
  
  :: Install Flash for IE
  \\path-to-server\Flash-IE-11.5.502.135.exe -install
  
  :: Kill Flash updating
  COPY /y \\path-to-server\mms.cfg C:\WINDOWS\System32\Macromed\Flash\mms.cfg
  
  :END
  </code></pre>
  
  <p>The problem is that it's not reading the version that's installed. Instead of echoing something like 11.5.502.135, it's echoing "%G". And since %G does not equal my desired version (11.5.502.135) it's installing every time.</p>
  
  <p>So narrowing it down, the following is my problem:</p>
  
  <pre><code>for /f "tokens=3 delims=    " %%G in ('reg query %key% /v DisplayVersion ^| findstr /i current') do (
  echo %%G
  if %%G EQU %latestVersion% goto END
  if %%G NEQ %latestVersion% goto Install
  )
  </code></pre>
  
  <p>When typing it out manually, as long as I stop at "DisplayVersion" I get the info I'm looking for. But once I proceed to the last part of what's inside the (), that's when I get the errors.</p>