Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for pict.bat

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

  1. @ECHO OFF
  2. ECHO.
  3. ECHO Pict_NT.bat, Version 2.00 for Windows NT 4 and later
  4. ECHO Displays all GIFs and JPEGs in a HTML file.
  5. ECHO.
  6. ECHO Written by Rob van der Woude
  7. ECHO http://www.robvanderwoude.com
  8. ECHO.
  9.  
  10. IF NOT "%OS%"=="Windows_NT" GOTO:EOF
  11. IF NOT EXIST *.GIF IF NOT EXIST *.JPG IF NOT EXIST *.JPEG GOTO:EOF
  12.  
  13. SETLOCAL
  14. :: Get code page
  15. FOR /F "tokens=*" %%A IN ('CHCP') DO FOR %%B IN (%%A) DO SET CodePage=%%B
  16. IF %CodePage% LSS 1000 (SET CharSet=ibm%CodePage%) ELSE (SET Charset=windows-%CodePage%)
  17.  
  18. SET Version=2.00
  19. SET OutFile="%~n0.htm"
  20. >  %OutFile% ECHO ^<html^>
  21. >> %OutFile% ECHO ^<head^>
  22. >> %OutFile% ECHO ^<title^>All GIFs and JPGs found in directory %CD%^</title^>
  23. >> %OutFile% ECHO ^<meta http-equiv="content-type" content="text/html; charset=%CharSet%" /^>
  24. >> %OutFile% ECHO ^<style type="text/css"^>img{max-width: 100%%;}^</style^>
  25.  
  26. >> %OutFile% ECHO ^</head^>
  27. >> %OutFile% ECHO ^<body^>
  28. >> %OutFile% ECHO ^<div style="text-align: center"^>
  29. >> %OutFile% ECHO ^<h1^>All GIFs and JPGs^</h1^>
  30. >> %OutFile% ECHO ^<h2^>found in directory^</h2^>
  31. >> %OutFile% ECHO ^<h2^>%CD%^</h2^>
  32. FOR %%A IN (*.GIF) DO (
  33. 	>> %OutFile% ECHO ^<p^>^&nbsp;^</p^>
  34. 	>> %OutFile% ECHO ^<p^>^<img src="%%~nxA" /^>^</p^>
  35. 	>> %OutFile% ECHO ^<p^>%%~nxA^</p^>
  36. )
  37. FOR %%A IN (*.JPG) DO (
  38. 	>> %OutFile% ECHO ^<p^>^&nbsp;^</p^>
  39. 	>> %OutFile% ECHO ^<p^>^<img src="%%~nxA" /^>^</p^>
  40. 	>> %OutFile% ECHO ^<p^>%%~nxA^</p^>
  41. )
  42. FOR %%A IN (*.JPEG) DO (
  43. 	>> %OutFile% ECHO ^<p^>^&nbsp;^</p^>
  44. 	>> %OutFile% ECHO ^<p^>^<img src="%%~nxA" /^>^</p^>
  45. 	>> %OutFile% ECHO ^<p^>%%~nxA^</p^>
  46. )
  47. >> %OutFile% ECHO ^<p^>^&nbsp;^</p^>
  48. >> %OutFile% ECHO ^<p^>This HTML page was generated using^</p^>
  49. >> %OutFile% ECHO ^<p^>Pict_NT.bat,  Version %Version%^</p^>
  50. >> %OutFile% ECHO ^<p^>Written by Rob van der Woude^</p^>
  51. >> %OutFile% ECHO ^<p^>^<a href="http://www.robvanderwoude.com"^>http://www.robvanderwoude.com^</a^>^</p^>
  52. >> %OutFile% ECHO ^</div^>
  53. >> %OutFile% ECHO ^</body^>
  54. >> %OutFile% ECHO ^</html^>
  55. START "Pict_NT.bat" %OutFile%
  56. ENDLOCAL
  57. GOTO:EOF
  58.  

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