HOW TO: Get a list of file names from a folder...then add <img> tags on them AUTOMATICALLY!!

Do you have a folder that has a lot of image files in it? And by that I mean...

Now, perhaps you want to get these image files you've collected onto the web for others to enjoy but don't want to spend twenty years making the file names into a format that can be viewable online. (For example, manually putting <img> tages onto ALL of the file names? SOUNDS LIKE AN AWFUL TIME, RIGHT??!!!
I'm going to try and keep this simple, yet detailed enough for people who aren't familiar with CMD (like myself lol)

***BEFORE YOU START: Make sure ALL of your image files are uploaded onto your desired web-page host into a single location. You'll need to reference that location
on Step 6

Here are links to the steps so you can JUMP to whatever part you need! (click a step to jump to the details)
1) Copy the file path of the folder that has file names in it you want to turn into a text list
2) Paste file path into the code I'm providing you
3) Open up Command Prompt (Also known as CMD)
4) Paste the code into Command Prompt
5) Check your output file, and you'll see a list of file names with file type extensions
---you could stop here, or continue depending on what you need---
6) Edit part-two of code I'm providing to you
7) Paste part-two of code into CMD
8) Check your output file, you'll see the list of file names are now edited!

divider
1) COPY THE FILEPATH OF THE FOLDER that has file names in it you want to turn into a text listfile path

divider
2) PASTE FILE PATH INTO CODE
I find it nice to edit the code in something like a blank text file or google doc (whatever your preference is) instead of type or edit it within CMD.
Warning: Having spaces in your filepath's folder names can cause issues.

This is the code you'll need to edit:
cd /d "C:\PASTE FILE PATH HERE" for %i in (*) do @echo %~nxi >> output.txt

Here is my edited example, I used my D:\ Drive instead of C:\, but it doesn't matter.
cd /d "D:\Pictures\NEWWEBSITE2023\MiniIcons\VERTICALthings"
for %i in (*) do @echo %~nxi >> output.txt

divider
3) OPEN UP COMMAND PROMPT (Also known as CMD)|
- Click the Windows (Start) icon
- Type or search for: Command (You can also type "cmd" to search for it)
- Open Command Prompt (it typically looks like a black/dark gray window (see pics below)
open command prompt

divider
4) PASTE THE CODE you edited into Command Prompt
- As the pic above shows, paste your edited code into CMD
- The code will run AUTOMATICALLY as soon as you paste it (if not, just try hitting enter on the keyboard).
- Make totally certain your file path is correct!
- If it doesn't work, the .txt file wont generate and CMD will typically explain what the error is (for instance, it can't find a file location, etc.)

divider
5) CHECK YOUR OUTPUT FILE , and you'll see a list of file names with file type extensions
---you could stop here, or continue depending on what you need---
outputfile
Above is what the .txt output file should look like. It'll have all the file names with extensions attached as a convenient list!

divider
6) EDIT PART TWO OF CMD CODE
Since we can't simply copy and paste this list of file names onto our webpage, we need to do one more step to get them webpage friendly!
Remember, red text in the code below references a file path on your WEB HOST'S server (like Neocities)
The blue text in the code below references a file explorer path on the PHYSICAL COMPUTER in front of you.

This is the code you'll need to edit if you want to add an <img> tag around all the file names automatically:
for /f "tokens=*" %a in (OUTPUT FILE FROM PART ONE .txt) do echo ^<img src="http://www.yoursite.com/yourwebpage/filepath/goeshere/%a"^> >>NEW OUTPUT FILE FOR PART TWO .txt

NOTE: ***You can play with what comes before or after the %a to your liking too!
The %a in the code represents the file name within the .txt. Essentially. It's a "loop variable" that represents each line of the input text file...erm...hey, listen I'm not really coder so I'm not going to get into mega detail on that XD

Here is my edited example:
for /f "tokens=*" %a in (D:\Pictures\NEWWEBSITE2023\MiniIcons\VERTICALthings\output.txt) do echo ^<img src="/.CuteDesktop/SMALLPIXELS/%a"^> >> D:\Pictures\NEWWEBSITE2023\MiniIcons\VERTICALthings\NewOutput.txt

So the above example will automatically change all the file names in the first text file we created. The NEW text file will have a list with desired file path, <img> tags, and the image name so it'll be READY TO GO onto your webpage!
<img src="/.CuteDesktop/SMALLPIXELS/filename.whatever">

divider
7 ) PASTE PART-TWO OF THE CODE into CMD and hit Enter!
The code you edited from step 6 should now be copy pasted into CMD, and a new output file should appear
If you get an error, just see what message CMD gives you as a hint for why it didnt work.
If you don't see the file and CMD didn't give an error, double check your file path. You may have sent the output somewhere else by accident.

divider
8 ) CHECK YOUR NEW OUTPUT FILE - you'll see the list of file names are now edited!
newoutput file
Everything is ready to go now! If you copy and paste this new output list into your webpage editor, everything should show correctly now.
final copy paste results

I really hope this helped you I know I'll be referencing it in the future!!