having trouble running a batch file from my C# windows application

  • Thread starter Thread starter Hanseller
  • Start date Start date
H

Hanseller

Guest
I am trying to run a batch file that runs another batch file from my windows application.

when i click the button, everything is frozen and i do not know why. The nested batch file was created to build html files from RST files I have a feeling that I am in a dead lock situation. Thank you so much guys for your help. I have attached a screen shot of my form and included my code as well.

private void buttonMakeHtml_Click(object sender, EventArgs e)
{
ProcessStartInfo processInfo = new ProcessStartInfo("cmd.exe", "/c" + "\"C:\\ReadTheDocs\\makeHtml.bat\"");
processInfo.CreateNoWindow = true;
processInfo.UseShellExecute = false;

processInfo.RedirectStandardError = true;
processInfo.RedirectStandardOutput = true;

var process = Process.Start(processInfo);

process.WaitForExit();

string output = process.StandardOutput.ReadToEnd();
string error = process.StandardError.ReadToEnd();

textBoxOutPut.Text = output;
textBoxError.Text = error;

}




1338116.png


Hanseller

Continue reading...
 
Back
Top