I have looked in this issue in a 3 years old question but couldn't adapt the batch script to work with my case: Rename text files based on multiple strings in their contents
This is what my text files contains:
<!-- ===============================================
TEXT TEXT"
===============================================
An : ONE
Ca : ONE - AVRIL 2016
Site : example.com -->
<!--===============================================
Insertion : example.com - Bannières Mobile 300X250 VF (300x250)
I want to rename every file with what the line Insertion :
contains. In my example it would be : example.com - Bannières Mobile 300X250 VF (300x250)
I tried to use this script and since it used Date and Time it the original question but I don't know how to make it work
setlocal enabledelayedexpansion
REM for all files do:
for %%f in (*.txt) do (
REM get desired lines and set variables:
for /f "tokens=2,4 delims=:" %%i in (' findstr "^Insertion" %%f') do set %%i=%%j
REM construct filename:
set "name=!Insertion!.txt"
echo Filename is: "!name!"
)
Can someone please help me adapting the code ?