Batch file to edit a .config file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 1
Joined: 19 Aug 2019 12:17

Batch file to edit a .config file

#1 Post by mtwa » 19 Aug 2019 12:29

I have a .config file that has a list of IP addresses, these IP addresses need updating. I need to update the config file on 115 computers.

I was hoping this could be done in a bat file that will delete the ip addresses already in the file and replaces them
For example it does something along the lines of

in the file c:/settings.config
between the text
<sites default="">
delete and replace with
<site ipAddress="" name="PC1" port="1001" number="1001"/>
<site ipAddress="" name="PC2" port="1001" number="1002"/>
<site ipAddress="" name="PC3" port="1001" number="1003"/>
<site ipAddress="" name="PC4" port="1001" number="1004"/>
<site ipAddress="" name="PC5" port="1001" number="1005"/>
<site ipAddress="" name="PC6" port="1001" number="1006"/>

Posts: 1822
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch file to edit a .config file

#2 Post by penpen » 25 Aug 2019 13:06

Depending on the content of your file you coudl either use Dave's JREPL.BAT:

Code: Select all
--- or you could use xslt to change the xml data; example:


Post Reply