I've created a simple batch file that searches in files with extension .opr and .eng for the term @DLOG_ETS and replace it with @DLOG_ETS=OFF. This may be redundant for cases where the full string is @DLOG_ETS=OFF.
I want to add the condition that only if the string @DLOG_ETS=ON is present, then I want to replace that with @DLOG_ETS=OFF. Otherwise, I want to leave it as it is, i.e. @DLOG_ETS=OFF without making any changes on those .opr or .eng files.
for %%F in (*.opr *.eng) do (
type "%%F"| findstr /v @DLOG_ETS= >"%%F.new"
@echo @DLOG_ETS=OFF >> "%%F.new"
move /y "%%F.new" "%%F"
)
Batch isn't predestined to do text file editing.
A lot of poison chars have to be circumvented.
Vbscript /jscript/PowerShell are all better suited to this task.
Here a batch which calls a sub to get help with Powershell. You need do adapt the path to your environment.