There are two missing details in your question:
- If the batch file will rename ALL the files in the directory, it will also rename the batch file itself, unless you start it in other directory; in such a case, the batch file must start with a CD command to enter to the working directory.
- You don't said if the renamed files must retain its extensions, so I supposed Yes. If the files to rename have a fixed extension (.TXT for example) you must change *.* by *.TXT, eliminate the SET EXT= line and use .TXT instead of !EXT!. In this case the previous detail don't apply.
This batch file do what you need:
@echo off
setlocal enabledelayedexpansion
for %%f in (*.) do (
set /p firstline=< %%f
set thedate=!firstline:~55,8!
set name=!thedate:/=-!
echo ren %%f !name!.txt
)
You must first test that this program show the right ren command and then eliminate the "echo " part.
For further details type SET /? and FOR /?
Regards...
=======================================
UPDATE:
I had modified the batch file so it is ready now to take files with no extension and rename they to .TXT files. To use it you just need to copy it to your disk and execute it, so, why not to test it?