Aloha,
I was using MS Visual studio net for the first time yesterday and made a simple calculator program in c#.
Now to my question: How can I run a dos command from C#? For example if I would to make a button that runs the command "ipconfig /all" or something like that.
Newbie Q: How can I run dos commands in C# e.g. ipconfig
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Ricardo Schroeder4 pointsPosted Oct 14, 2005, 6:51 AM EDT
csharphelp26 pointsPosted Oct 26, 2005, 2:41 AM EDT
try this using System.Diagnostics; Process p=new Process(); p.StartInfo.FileName="cmd.exe"; p.StartInfo.CreateNoWindow=true; p.StartInfo.UseShellExecute=false; p.StartInfo.Arguments="\k dir";//where dir can be any dos command p.Start();