I have tried to run the batch file from c# using the following code and i want to display the result in WPF textbox. Could you please guide me how to do this?
using System;
namespace Learn
{
class cmdShell
{
[STAThread] // Lets main know that multiple threads are involved.
static void Main(string[] args)
{
System.Diagnostics.Process proc; // Declare New Process
proc = System.Diagnostics.Process.Start("C:\\listfiles.bat"); // run test.bat from command line.
proc.WaitForExit(); // Waits for the process to end.
}
}
}
This batch file is to list the files from the folder. Once the batch is executed result should be displayed in the textbox. If the batch file having more than one commands, then result of each commands should be displayed in textbox.