findstr
will not return any single values to you. It will only search for a string and return the whole line. try this vbscript
Set objFS = CreateObject( "Scripting.FileSystemObject" )
Set d = CreateObject("Scripting.Dictionary")
strFolder= WScript.Arguments(0)
Set objFolder = objFS.GetFolder(strFolder)
For Each strFile In objFolder.Files
If objFS.GetExtensionName(strFile) = "txt" Then
strFileName = strFile.Name
Set objFile = objFS.OpenTextFile(strFile)
Do Until objFile.AtEndOfStream
strLine=objFile.ReadLine
If InStr(strLine,"File Reference") > 0 Then
s=Split(strLine,"File Reference : ")
num=Split( s(UBound(s))," ")
number=Mid(num(0),2) 'get the number
strNewFileName = "CLL"&CStr(number)&".txt"
objFile.Close
strFile.Name = strNewFileName
Exit Do
End If
Loop
Set objFile=Nothing
End If
Next
save as myscript.vbs
and run it
C:\download_folder> cscript //nologo myscript.vbs c:\download_folder