i have done something similar before.
"get the value by using directoryinfo.getfiles(*.bat)" or something like this" u need the path to the file here
this is from memory so there may be little mistakes but this is how to do.
string batlocation=".bat location";
string battxt = String.Empty;
if (File.Exists(batlocation))
{
using ( var reader = new StreamReader(batlocation))
{
battxt = reader.ReadToEnd();
}
}
now u can use some string replace or search or regex to change the bat file.
then if you would like to write changes over just
do like this
if (File.Exists(batlocation))
{
File.Move(batlocation)
using ( var writer = new StreamWriter(batlocation))
{
battxt = writer.Write(battxt)
}
}