Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lens.bat

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

  1. @ECHO OFF
  2. IF     "%~1"=="" GOTO Syntax
  3. IF NOT "%~2"=="" GOTO Syntax
  4. IF NOT EXIST "%~1" (
  5. 	ECHO.
  6. 	ECHO ←[1;31mERROR:←[0;1m  image not found: "%~1"←[0m
  7. 	GOTO Syntax
  8. )
  9. PHP.EXE -? >NUL 2>&1
  10. IF ERRORLEVEL 1 (
  11. 	ECHO.
  12. 	ECHO ←[1;31mERROR:←[0;1m  PHP.EXE not found←[0m
  13. 	GOTO Syntax
  14. )
  15.  
  16. SETLOCAL
  17. SET File=%~1
  18. SET File=%File:\=/%
  19. PHP.EXE -r "print(@exif_read_data('%File%',null,true)['EXIF']['UndefinedTag:0xA434']);" | FINDSTR.EXE /R /C:"."
  20. ENDLOCAL & EXIT /B %ErrorLevel%
  21.  
  22.  
  23. :Syntax
  24. ECHO.
  25. ECHO Lens.bat,  Version 1.00 for Windows 10 and later
  26. ECHO Use PHP to read the lens type from an image's EXIF data
  27. ECHO.
  28. ECHO Usage:  ←[1mLens.bat  image←[0m
  29. ECHO.
  30. ECHO Where:            ←[1mimage←[0m  is the image file to be investigated
  31. ECHO.
  32. ECHO Notes:  This batch file requires PHP.EXE, which can be downloaded from
  33. ECHO         ←[1;30mhttps://www.php.net/downloads.php←[0m
  34. ECHO         Successfully extracted lens data will be displayed on screen.
  35. ECHO         The batch file can return the following errorlevels:
  36. ECHO           0:  lens data successfully extracted
  37. ECHO           1:  no lens data could be found
  38. ECHO          -1:  command line error, or image or PHP.EXE not found
  39. ECHO.
  40. ECHO Written by Rob van der Woude
  41. ECHO https://www.robvanderwoude.com
  42.  
  43. EXIT /B -1
  44.  

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