Jump to content

Update text file batch file


Recommended Posts

Guest Richhall
Posted

Hi

 

I have an application on a number of users workstations on the

network, and want to amend an entry in a text file e.g config.ini on

all workstations. Can i connect using a batch to delete a line and add

a line or find text and change it within a file if I know all the IP

addresses?

 

i.e

 

[parameter 1] Item=Y

[parameter 1] Item=N

[parameter 1] Item=Y

[parameter 1] Item=N

[parameter 1] DNS=test.systems.co.uk

 

i want to change to:

 

[parameter 1] Item=Y

[parameter 1] Item=N

[parameter 1] Item=Y

[parameter 1] Item=N

[parameter 1] DNS=test2.systems.co.uk

 

Cheers

 

Rich

  • Replies 3
  • Created
  • Last Reply
Guest Pegasus \(MVP\)
Posted

Re: Update text file batch file

 

 

"Richhall" <rje.hall@yahoo.co.uk> wrote in message

news:495d7ce1-1cba-41d7-b3f4-43c899db08fa@a70g2000hsh.googlegroups.com...

> Hi

>

> I have an application on a number of users workstations on the

> network, and want to amend an entry in a text file e.g config.ini on

> all workstations. Can i connect using a batch to delete a line and add

> a line or find text and change it within a file if I know all the IP

> addresses?

>

> i.e

>

> [parameter 1] Item=Y

> [parameter 1] Item=N

> [parameter 1] Item=Y

> [parameter 1] Item=N

> [parameter 1] DNS=test.systems.co.uk

>

> i want to change to:

>

> [parameter 1] Item=Y

> [parameter 1] Item=N

> [parameter 1] Item=Y

> [parameter 1] Item=N

> [parameter 1] DNS=test2.systems.co.uk

>

> Cheers

>

> Rich

 

You could do it with this batch file:

@echo off

set Source=\\192.168.1.10\c$\Some Folder\Some File.txt

type "%Source%" | find /i /v "DNS=" > "%temp%\temp.txt"

copy /y "%temp%\temp.txt" "%Source%" > nul

echo [parameter 1] DNS=test2.systems.co.uk >> "%Source%"

Guest Richhall
Posted

Re: Update text file batch file

 

excellent thank you

Guest Pegasus \(MVP\)
Posted

Re: Update text file batch file

 

 

"Richhall" <rje.hall@yahoo.co.uk> wrote in message

news:8380ebfc-1753-4676-ba6c-4f59a5fcfc8c@25g2000hsx.googlegroups.com...

> excellent thank you

>

 

You're welcome.


×
×
  • Create New...