@echo off
setlocal disableDelayedExpansion
cd C:\Documents and Settings\e51084\Desktop\New\Interest\f2
Set "SrcDir=C:\Documents and Settings\e51084\Desktop\New\Interest\f2"
Set "Mask=*.txt"
Set "Line#=23"
Set "LOfs=44"
Set "Len=46"
If /I Not "%CD%"=="%SrcDir%" Pushd "%SrcDir%"2>Nul&&(Set _=T)||Exit/B
For /F "Tokens=1-2* Delims=:" %%A In ('FindStr/N "^" "%Mask%" 2^>Nul'
) Do If "%%B"=="%Line#%" If Not "%%~C"=="" (Set "Line=%%C"
SetLocal EnableDelayedExpansion
If Not "!Line:~%LOfs%,%Len%!"=="" (
If Not Exist "!Line:~%LOfs%,%Len%!" (
Pause
Ren "%%A" "!Line:~%LOfs%,%Len%!"))
Pause
EndLocal)
If "_"=="T" PopD
The above searches a directory and renames fle name of all text files with some of the text within file.
I now need some help in how to remove / from !Line:~%LOfs%,%Len%! as filenames cannot have /.
If anyone can lead me in the right direction I would appreciate it.
All help appreciated
Thank you.