Find File and Replace Word in XML or TXT

Asked

Viewed 1,123 times

0

Hello,

I have to create a DOS (Windows) command line script, which locates one or several files. xml that are located in a certain directory and change a value of a tag, this tag can be fixed, IE, I will always search it and change by a preset value.

Directory - C: XML (in this directory will be deposited the files generated by the system to make the tag change)

We assume that when running a dir in this directory list three files. xml ( teste1.xml, teste2.xml and teste3.xml), file numbers and filenames will not be standard.

After locating the files all must be checked to locate and replace a certain phrase (TAG) within the file. Example, locate the tag <nome>fulano</nome> and replaced by <nome>ciclano</nome>

  • By the command line you won’t be able to do that. easier to use the Notepad++, or, if really necessary, make your own tool (which is also not complicated)

  • 2

    Use the FART or Powershell

  • I tested by FART (the little name hein) and it worked perfectly. Grateful

  • can do yes per command line using FOR but as the friend already used fart32, there is no need for me to build the script.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.