1

I need to display a lot of GIF pictures in one place, and being able to add some whenever I want. The solution I have found is to create a batch file which creates an HTML page displaying the GIF. But I'm a beginner with CMD language and after some research here is what I have written :

FOR /F %%G IN ('dir /B *.gif') DO echo ^<img src="%%G"^>^ ^<br^>^<br^>^<br^> >> gifs.html

It works but it is really simple, and I don't seem to be able to add page settings and layout (such as center the GIFs, maybe add a background etc...) automatically from the Batch. I can't find anything on the web as to how to do that. Can someone put me on the rails here ?

Thanks very much !!

Djokito

Djokito
  • 13
  • 2
  • You might find [this answer](http://stackoverflow.com/a/27652107/1683264) useful. Just sayin'. – rojo Mar 31 '16 at 00:52

1 Answers1

1

you can create separate static CSS file (named e.g.: your.css) in the same folder containing something like:

body{
  text-align: center;
  background-color: #aaaaaa;
}

img{
  width: 300px;
}

and then add this line to the beginning of your batch file:

echo ^<link type="text/css" href="your.css"^> >> gifs.html
cdm
  • 1,360
  • 11
  • 18
  • That's exactly the type of answer I was expecting ! Thanks, gonna try it right now ! Quick question, if I write multiple lines in my batch file ending in ">> gifs.html", it will add the lines after the other in the html doc ? – Djokito Mar 30 '16 at 14:52
  • Ok it worked great, I just had to add "rel="stylesheet"" in the code to make it work ! Thanks :) – Djokito Mar 30 '16 at 15:06