Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I got the following output example displays a messagebox how to do?

C#
System.Diagnostics.Process.Start("cmd.exe", "/c ipconfig -t");
Posted
Comments
Sergey Alexandrovich Kryukov 11-Jan-13 18:57pm    
I removed your fake "answer", especially with "CMD.EXE"? Can you finally understand that this is totally wrong?!
And you are not supposed to "answer" your own question. All you could get is some down-voted or abuse reports.
:doh:
—SA

This might help get you started,

http://social.msdn.microsoft.com/Forums/is/csharplanguage/thread/7bd92d7d-15c0-4da5-a452-5c397437ecc7[^]

C#
void MainForm_Load(object sender, EventArgs e)
    {
      System.Diagnostics.Process p = new System.Diagnostics.Process();
      p.StartInfo.UseShellExecute = false;
      p.StartInfo.FileName = "cmd.exe";
      p.StartInfo.Arguments = "/c ipconfig";
      p.StartInfo.RedirectStandardError = true;
      p.StartInfo.RedirectStandardInput = true;
      p.StartInfo.RedirectStandardOutput = true;

      p.Start();

      StreamReader outputWriter = p.StandardOutput;
      String errorReader = p.StandardError.ReadToEnd();
      String line = outputWriter.ReadLine();
      while (line != null)
      {
        Console.WriteLine(line);
        line = outputWriter.ReadLine();
      }
      p.WaitForExit();
    }
 
Share this answer
 
v3
Comments
samadblaj 11-Jan-13 18:25pm    
no..............
DinoRondelly 11-Jan-13 18:28pm    
Try this one - http://social.msdn.microsoft.com/Forums/is/csharplanguage/thread/7bd92d7d-15c0-4da5-a452-5c397437ecc7
samadblaj 11-Jan-13 18:35pm    
yessssssss, tnx.
samadblaj 11-Jan-13 18:26pm    
View cmd output in messagebox???
Sergey Alexandrovich Kryukov 11-Jan-13 18:36pm    
Same thing as Dino demonstrate, only line goes to your favorite message box. Isn't that obvious?!
—SA
Wait a second. What a command line!

Isn't this obvious that you absolutely don' need CMD.EXE. This is just one of the applications, nothing else, totally unrelated to your problem.

You need:
C#
System.Diagnostics.Process.Start("ipconfig",  "-t");


Oh!..

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900