samedi 17 décembre 2016

Dos Batch file programming

I've created a simple batch file that looks through file with extension .opr and .eng and looks 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, ie. @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"enter code here @echo @DLOG_ETS=OFF >> "%%F.new" move /y "%%F.new" "%%F" )

Aucun commentaire:

Enregistrer un commentaire