Hi All,
I want to run a command in Visual Studio Command Prompt & this should happen using either c#.net or VB.net.
I mean from C#.Net/vb.net I should be able to open VS Command prompt & execute a Command & this data to be returned back.
Thanks & Regards,
Surya Prakash
Loading

Suthish NairPosted Sep 15, 2011, 11:00 AM
VulpesPosted Sep 15, 2011, 8:36 AM
http://www.c-sharpcorner.com/Forums/Thread/140142/can-any-one-help-me-out-in-executing-this-code.aspx
Surya PrakashPosted Sep 15, 2011, 7:59 AM
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);
Surya PrakashPosted Sep 15, 2011, 7:56 AM
VulpesPosted Sep 15, 2011, 6:17 AM
Jiteendra SampathiraoPosted Sep 15, 2011, 6:10 AM
Go through this Link