Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for filever.bat

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

  1. @ECHO OFF
  2. IF [%1]==[] GOTO Syntax
  3. IF NOT [%2]==[] GOTO Syntax
  4. ECHO.%1 | FIND "?" >NUL
  5. IF NOT ERRORLEVEL 1 GOTO Syntax
  6. IF NOT EXIST %1 GOTO Syntax
  7. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  8.  
  9. SETLOCAL
  10. SET FileVer=
  11. FOR /F "tokens=1 delims=[]" %%A IN ('STRINGS %1 ^| FIND /N /V "" ^| FIND /I "FileVersion"') DO SET LineNum=%%A
  12. SET /A LineNum += 1
  13. FOR /F "tokens=1* delims=[]" %%A IN ('STRINGS %1 ^| FIND /N /V "" ^| FIND "[%LineNum%]"') DO SET FileVer=%%B
  14. SET FileVer
  15. ENDLOCAL
  16. GOTO:EOF
  17.  
  18. :Syntax
  19. ECHO.
  20. ECHO FileVer.bat,  Version 1.00 for NT 4 / 2000 / XP
  21. ECHO Display the specified file's version number
  22. ECHO.
  23. ECHO Usage:  FILEVER  progfile
  24. ECHO.
  25. ECHO Where:  "progfile" is the name of a Windows executable, DLL, or system file
  26. ECHO.
  27. ECHO Uses SysInternal's STRINGS.EXE, avalable at http://www.sysinternals.com
  28. ECHO.
  29. ECHO Written by Rob van der Woude
  30. ECHO http://www.robvanderwoude.com
  31.  

page last uploaded: 2017-04-06, 13:33