After opening process start command prompt how to write ipconfig in c#

c#, console-application

Solution

EDIT

Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "ipconfig.exe";
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();
return output;

or

EDIT

  Process pr = new Process();
  pr.StartInfo.FileName = "cmd.exe";
  pr.StartInfo.Arguments = "/k ipconfig"; 
  pr.Start();

Check : How to Execute a Command in C# ?

System.Diagnostics.Process process = new System.Diagnostics.Process(); 
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
 startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
 startInfo.FileName = "cmd.exe";
 startInfo.Arguments = "ipconfig";
 process.StartInfo = startInfo;
 process.Start(); 

or

Problem

I am opening the command prompt from c# ``` Process.Start("cmd"); ``` when it opens i need to write ipconfig automatically such that process opens and finds the ip of the workstation, How should i do that?

Original source

Related problems