I don't have much experience with batch scripts, and my employer has asked me write a batch script that can be run to find and replace some text inside all matching files in the directory.
I've tried searching this and there's a tonne of resource, which I've used to get me this far:
@echo off
setlocal enableextensions disabledelayedexpansion
set "search=<employeeloginid>0"
set "replace=<employeeloginid>"
set "textFile=TimeTEQ20170103T085714L.XML"
for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
>>"%textFile%" echo(!line!
endlocal
)
This will find all occurrences of <employeeloginid>0
and replace it with <employeeloginid>
inside a set file - in this case TimeTEQ20170103T085714L.XML
.
I now need to tweak this to run on all files that start with TimeTEQ
and end with .xml
I found this answer which shows how to do all files in a directory, but I don't know how I would tweak it to suit my needs here.
Can anyone help me please?