Batch to Generate Button Links

01/03/20

Tags Neocities

I’ve been collecting NeoCities buttons off and on and I decided to archive them all on my 88x31 page. You can automate boring tasks in the Command Line with Batch. I saved the images as username.ext, so I can use the following snippet to iterate over all the .png and .gif buttons in a folder and generate an image link based on the filename.

for %i in (*.gif, *.png, *.jpg) do echo ^<a href="//%~ni.neocities.org/"^>^<img src="/images/buttons/neocitizens/%i" alt="%~ni"/^>^</a^>>> all.html

Note to self: Find \r\n Replace with space.