Surya Prakash

Surya Prakash

  • NA
  • 1.7k
  • 1.2m

Can any one help me out in executing this code

Sep 15 2011 8:01 AM
Hi,

Can any one help me out in executing this code
 
string command = @" tf help > tfshistory.txt";
System.Diagnostics.ProcessStartInfo procStartInfo =
new System.Diagnostics.ProcessStartInfo(@"cmd", @" C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" + command);
 
// The following commands are needed to redirect the standard output.
// This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.RedirectStandardOutput = true;
procStartInfo.UseShellExecute = false;
// Do not create the black window.
procStartInfo.CreateNoWindow = true;
// Now we create a process, assign its ProcessStartInfo and start it
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo = procStartInfo;
proc.Start();
// Get the output into a string
string result = proc.StandardOutput.ReadToEnd();
// Display the command output.
Console.WriteLine(result);
MessageBox.Show(result);
 

 
Thanks,
Prakash

Answers (2)