For example i have this code:
Process proc = new Process();
proc.EnableRaisingEvents = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName
As long as you have no variables or nonsingleline-commands you can run this function with each line of the bat-file
internal static void executeCommand(string command, bool waitForExit,
bool hideWindow, bool runAsAdministrator)
{
System.Diagnostics.ProcessStartInfo psi =
new System.Diagnostics.ProcessStartInfo("cmd", "/C " + command);
if (hideWindow)
{
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
}
if (runAsAdministrator)
{
psi.Verb = "runas";
}
if (waitForExit)
{
System.Diagnostics.Process.Start(psi).WaitForExit();
}
else
{
System.Diagnostics.Process.Start(psi);
}
}
so you can also save the text in the code
string bat_file = @"@echo off\ncopy c:\users\Desktop\filea.txt c:\users\Desktop\fileb.txt\n...";
otherwise i would create a temporary bat file, run it and delete it.