title: VBS or Bat - Determine OS and Office Version
body: <p>Does anyone have a script that can determine the Windows OS and Office Version in the same script.</p>
  
  <p>I have bits and pieces of the script but I can't seem to figure out how to incorporate both OS and Office Version in the script.  I started out in bat now I moved on to VBS as it seems to be able to provide more details however, if someone could just help out with logic in below I might be able to move forward.</p>
  
  <p>I would like to know how I can setup a script like this.</p>
  
  <pre><code>If Windows 7 64bit &amp; Office 2010
      do this
  If Windows XP 32bit &amp; Office 2007
      do this  
  If Windows 7 &amp; Office 2007
      do this
  </code></pre>
  
  <p>CODE FOR Detecting Windows Version  -- BAT SCRIPT</p>
  
  <pre><code>Echo Please wait.... detecting Windows OS version...
  ver | find "2003" &gt; nul
  if %ERRORLEVEL% == 0 goto done
  
  ver | find "XP" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_xp
  
  ver | find "2000" &gt; nul
  if %ERRORLEVEL% == 0 goto done
  
  ver | find "NT" &gt; nul
  if %ERRORLEVEL% == 0 goto done
  
  if not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexit
  
  systeminfo | find "OS Name" &gt; %TEMP%\osname.txt
  FOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%i
  
  echo %vers% | find "Windows 7" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_7
  
  echo %vers% | find "Windows Server 2008" &gt; nul
  if %ERRORLEVEL% == 0 goto done
  
  echo %vers% | find "Windows Vista" &gt; nul
  if %ERRORLEVEL% == 0 goto ver_7
  
  goto warnthenexit
  </code></pre>