I have scripted OfficeVer.bat to return the major version of Microsoft Office that the current user has installed.

The syntax for using OfficeVer.bat is:

\[call\] OfficeVer Ver

Where Ver is a call directed environment variable that will contain the two digit major version, or a 00 if Microsoft Office is NOT installed for this user.

OfficeVer.bat contains:

@echo off                              if \{%1\}==\{\} @echo OfficeVer Version&goto :EOF                              setlocal EnableDelayedExpansion                              set ver=00                              If exist "%TEMP%\OfficeVer.TMP" del /q /f "%TEMP%\OfficeVer.TMP"                              regedit /a "%TEMP%\OfficeVer.TMP" "HKEY_CURRENT_USER\Software\Microsoft\Office"                              set F1=find /i "HKEY_CURRENT_USER"                              set F2=find /i "Office"                              for /f "Skip=1 Tokens=1,5 Delims=\.\]" %%a in ('type "%TEMP%\OfficeVer.TMP"^|%F1%^|%F2%') do (                               if "!ver!" EQU "00" If "%%b" NEQ "" set ver=%%b                              )                              If exist "%TEMP%\OfficeVer.TMP" del /q /f "%TEMP%\OfficeVer.TMP"                              endlocal&set %1=%ver%