Q. How can I determine what version of Microsoft Office the current user has installed?

Jerold Schulman

November 7, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 offif {%1}=={} @echo OfficeVer Version&goto :EOFsetlocal EnableDelayedExpansionset ver=00If exist "%TEMP%OfficeVer.TMP" del /q /f "%TEMP%OfficeVer.TMP"regedit /a "%TEMP%OfficeVer.TMP" "HKEY_CURRENT_USERSoftwareMicrosoftOffice"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%


Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like