Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lstoffvw.bat

(view source code of lstoffvw.bat as plain text)

  1. @ECHO OFF
  2. ECHO.
  3. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  4. IF NOT  "%~1"==""           GOTO Syntax
  5.  
  6. :: Enable delayed variable expansion
  7. SETLOCAL ENABLEDELAYEDEXPANSION
  8.  
  9. :: Create a variable containing 40 spaces
  10. SET Space40=
  11. FOR /L %%C IN (1,1,40) DO SET Space40= !Space40!
  12.  
  13. :: Search the "\Program Files\Microsoft Office" directory for "Office*" subdirectories
  14. FOR /D %%A IN ("%ProgramFiles%.\Microsoft Office\Office*") DO (
  15. 	REM Look for *view.exe and/or vviewer.dll
  16. 	FOR %%B IN ("%%~fA\*view.exe" "%%~fA\vviewer.dll") DO (
  17. 		IF EXIST "%%~B" (
  18. 			REM Store the file description in an environment
  19. 			REM variable, and append 40 spaces
  20. 			FOR /F "tokens=1*" %%C IN ('FILEVER.EXE "%%~fB" /V ^| FIND.EXE "FileDescription"') DO SET Viewer=%%D%Space40%
  21. 			REM Display the description, limiting its length to
  22. 			REM 40 characters, and append the product version
  23. 			FOR /F "tokens=1*" %%C IN ('FILEVER.EXE "%%~fB" /V ^| FIND.EXE "ProductVersion"') DO SET Version=%%D
  24. 				ECHO !Viewer:~0,40!	!Version!
  25. 			)
  26. 		)
  27. 	)
  28. )
  29. ENDLOCAL
  30. GOTO:EOF
  31.  
  32.  
  33. :Syntax
  34. ECHO LstOffVw.bat,  Version 1.00 for Windows 2000 and later
  35. ECHO List all Office Viewers installed on the local computer
  36. ECHO.
  37. ECHO Usage:  LSTOFFVW
  38. ECHO.
  39. ECHO Notes:  This batch file requires FILEVER.EXE, which is part of the Windows
  40. ECHO         Support Tools. The Windows Support Tools are located on the Windows
  41. ECHO         installation CD, but aren't installed by default. To install them,
  42. ECHO         navigate to the \SUPPORT folder on your Windows CD and run SETUP.
  43. ECHO.
  44. ECHO Written by Rob van der Woude
  45. ECHO http://www.robvanderwoude.com
  46.  

page last modified: 2024-04-16; loaded in 0.0155 seconds