I'm using batch files to process text files with names of the form: CLL*1.txt, CLLM*2.txt located in a specific "download" folder. All files contain a string of the form: "File Reference : 0xxxx", where xxxx is a unique numerical identifier.
I am trying, without much success, to use the following script to rename the file to CLL*xxxx.txt (where xxxx replaces the integer suffix). Can anyone help?:
set target="S:\download\"
SetLocal EnableDelayedExpansion enableextensions
for /f "usebackq tokens=2 delims=:" %%i IN (`findstr /b "File Reference :" %target%CLL*.txt`) do (
ren %target%CLL*.txt CLL*%%i.txt
)
Endlocal