3

I want to find string e.g. "date" from my files of a folder which contains multiple ".c" and ".h" files in it and replace it with "date 24-April-2018" using batch file. what should do? Please see below code. I want to do the same but not for one file Input.txt , I want to do for multiple files with extensions of a folder

@echo off 
setlocal enableextensions disabledelayedexpansion

set "search=@date"
set "replace=@date 24-apr-2018"

set "textFile=Input.txt"

for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
    set "line=%%i"
    setlocal enabledelayedexpansion
    >>"%textFile%" echo(!line:%search%=%replace%!
    endlocal
)
Meera
  • 31

0 Answers0