Update text file batch file

  • Thread starter Thread starter Richhall
  • Start date Start date
R

Richhall

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
 
Richhall said:
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%"
 
Back
Top