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


Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Sep 15, 2011, 2:10 AM EDT
Go through this Link
VulpesRank #55 · 29.2K reputationPosted Sep 15, 2011, 2:17 AM EDT
Surya PrakashRank #1,093 · 1.7K reputationPosted Sep 15, 2011, 3:56 AM EDT
Surya PrakashRank #1,093 · 1.7K reputationPosted Sep 15, 2011, 3:59 AM EDT
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);
VulpesRank #55 · 29.2K reputationPosted Sep 15, 2011, 4:36 AM EDT
http://www.c-sharpcorner.com/Forums/Thread/140142/can-any-one-help-me-out-in-executing-this-code.aspx
Suthish NairRank #92 · 22.8K reputationPosted Sep 15, 2011, 7:00 AM EDT