user3767480
user3767480

Reputation: 1

How to automate text file update in windows 7

I have a file called environment text file

Path: C:\Program Files (x86)\CPW\CPW.INI

Its has data

PORT : 2012

Now i want to create a exe or some program which will directly run on system and update this particular text file with new data.

PORT : 2014.

I have around 6000 users, so i need to broadcast the program to all of them , so that their file can be updated automated just my running my mailed program.

Please Help Ashu

Upvotes: 0

Views: 98

Answers (1)

James Hunt
James Hunt

Reputation: 2528

If you use C#, you can use File.WriteAllText to overwrite the text within a file. Encased within a main function you end up with:

using System.IO;
using System;

class Program
{
    static void Main()
    {
        File.WriteAllText(@"C:\Program Files (x86)\CPW\CPW.INI", "PORT : 2014");
    }
}

Upvotes: 1

Related Questions