@ECHO OFF ECHO. IF NOT "%OS%"=="Windows_NT" GOTO Syntax IF NOT "%~1"=="" GOTO Syntax :: Enable delayed variable expansion SETLOCAL ENABLEDELAYEDEXPANSION :: Create a variable containing 40 spaces SET Space40= FOR /L %%C IN (1,1,40) DO SET Space40= !Space40! :: Search the "\Program Files\Microsoft Office" directory for "Office*" subdirectories FOR /D %%A IN ("%ProgramFiles%.\Microsoft Office\Office*") DO ( REM Look for *view.exe and/or vviewer.dll FOR %%B IN ("%%~fA\*view.exe" "%%~fA\vviewer.dll") DO ( IF EXIST "%%~B" ( REM Store the file description in an environment REM variable, and append 40 spaces FOR /F "tokens=1*" %%C IN ('FILEVER.EXE "%%~fB" /V ^| FIND.EXE "FileDescription"') DO SET Viewer=%%D%Space40% REM Display the description, limiting its length to REM 40 characters, and append the product version FOR /F "tokens=1*" %%C IN ('FILEVER.EXE "%%~fB" /V ^| FIND.EXE "ProductVersion"') DO SET Version=%%D ECHO !Viewer:~0,40! !Version! ) ) ) ) ENDLOCAL GOTO:EOF :Syntax ECHO LstOffVw.bat, Version 1.00 for Windows 2000 and later ECHO List all Office Viewers installed on the local computer ECHO. ECHO Usage: LSTOFFVW ECHO. ECHO Notes: This batch file requires FILEVER.EXE, which is part of the Windows ECHO Support Tools. The Windows Support Tools are located on the Windows ECHO installation CD, but aren't installed by default. To install them, ECHO navigate to the \SUPPORT folder on your Windows CD and run SETUP. ECHO. ECHO Written by Rob van der Woude ECHO http://www.robvanderwoude.com