Check for Office version via script

Check for Office Version:

Create a text file and save it as purpose_office_version.bat

@Echo off

REM Check most recent office version assuming default installation path has been chosen.

REM 2013

if exist "C:\Program Files\Microsoft Office 15\root\office15\winword.exe" goto Office201364

if exist "C:\Program Files (x86)\Microsoft Office 15\root\office15\winword.exe" goto Office201332

REM 2010

if exist "C:\Program Files\Microsoft Office\Office14\WINWORD.EXE" goto Office201064

if exist "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" goto Office201032

REM 2007

if exist "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE" goto Office2007

REM 2003

if exist "C:\Program Files (x86)\Microsoft Office\Office11\WINWORD.EXE" goto Office2003

REM XP

if exist "C:\Program Files (x86)\Microsoft Office\Office10\WINWORD.EXE" goto OfficeXP

goto error

:Office201364
ECHO Office 2013 64 bit Detected
*CODE HERE*
GOTO exit


:Office201332
ECHO Office 2013 32 bit Detected
*CODE HERE*
GOTO exit


:Office201064
ECHO Office 2010 64 bit Detected
*CODE HERE*
GOTO exit


:Office201032
ECHO Office 2010 32 bit Detected
*CODE HERE*
GOTO exit


:Office2007
ECHO Office 2007 32 bit Detected
*CODE HERE*
GOTO exit


:Office2003
ECHO Office 2003 32 bit Detected
*CODE HERE*
GOTO exit


:OfficeXP
ECHO Office XP 32 bit Detected
*CODE HERE*
GOTO exit

:error
Echo No Office version detected. Call your system administrator.
pause
goto exit


:exit
exit