The set of batch files presented here are meant to create an HTML file referencing all *.GIF files in the current directory.
I created these batch files for my son, to view his collection of animated GIFs.
The general idea is that one batch file - __GIF.BAT - calls a second batch file - ___GIF.BAT - once for each GIF it finds.
This second batch file will display the GIF in an <IMG> tag.
A third batch file - _GIF.BAT - is needed to call the first one, providing enough environment space and redirecting the output to an HTML file _GIF.HTM.
This batch file has been tested in Windows 98 and in OS/2 Warp 4.
The only "problem" left to be solved is the empty <IMG> tag that is created at the end of _GIF.HTM.
The "source code" for the main batch file __GIF.BAT:
@ECHO OFF REM __GIF.BAT REM Save current PROMPT SET OLDPRM=%PROMPT% REM Set PROMPT to display starting HTML tags PROMPT $LHTML$G$_$LBODY$G$_$_$LIMG=" REM Set ECHO on, insert 1 empty line and then set REM ECHO off again to actually display the prompt ECHO ON @ECHO OFF REM Set PROMPT to display HTML IMG tags PROMPT "$G$_$LIMG src=" REM Call secondary batch file ___GIF.BAT REM for each GIF in the current directory FOR %%A IN (*.GIF) DO CALL ___GIF %%A REM Set PROMPT to display closing HTML tags PROMPT "$G$_$L/HTML$G$_$L/BODY$G REM Set ECHO on, insert 1 empty line and then set REM ECHO off again to actually display the prompt ECHO ON @ECHO OFF REM Restore original PROMPT PROMPT %OLDPRM%
The "source code" for the secondary batch file ___GIF.BAT:
@ECHO OFF REM ___GIF.BAT REM Set ECHO on, display GIF name (%1), and then 1 empty line to display REM the PROMPT, which was set by __GIF.BAT to display an HTML IMG tag ECHO ON @ECHO %1 @ECHO OFF
And finally the batch file that is used to start it all, _GIF.BAT:
@ECHO OFF REM _GIF.BAT REM Create an HTML file containing all GIF files in the current directory REM Needs both __GIF.BAT and ___GIF.BAT REM /E:512 parameter is used to ensure sufficient environment space COMMAND /E:512 /C __GIF.BAT > _GIF.HTM
|Note:||The PROMPT can be set using either
Use the first method if you need to include "=" characters in string, or replace "=" with "$Q" if you insist on using the second method.
The batch file PICTURES.BAT and its helper batch files PICTURE2.BAT and PICTURE3.BAT will do the same things _GIF.BAT does, but for both GIF and JPG files.
It will create an HTML file PICTURES.HTM.
Recently an NT version has been added: Pict_NT.bat, which consists of one single batch file.
page last modified: 2011-03-04