Calling the IPConfig process

  • Thread starter Thread starter Manoj Nair
  • Start date Start date
M

Manoj Nair

Hi,
How can I get the output of IPConfig into a text file in c#
thanks
Manoj Nair
 
Manoj,

If you insist on running IPconfig, then you can just pipe it into a
file, like so:

ipconfig /all > ipconfig.txt

And it will create a file, ipconfig.txt, which you can then do what you
want with.

However, you can get all of the information programatically, which is
much better than parsing apart a text file.

Hope this helps.
 
Thanks Nicholas
but i was looking for a use of the Process.start in calling the IpConfig.exe
need it for an application
the normal
...
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "ipconfig.exe";
p.StartInfo.Arguments ="/all";
p.Start();
p.WaitForExit();
string output = p.StandardOutput.ReadToEnd();
......
wasnt working and at times sending the application into a loop
Needed some help in that
thanks in advance
Manoj
Nicholas Paldino said:
Manoj,

If you insist on running IPconfig, then you can just pipe it into a
file, like so:

ipconfig /all > ipconfig.txt

And it will create a file, ipconfig.txt, which you can then do what you
want with.

However, you can get all of the information programatically, which is
much better than parsing apart a text file.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Manoj Nair said:
Hi,
How can I get the output of IPConfig into a text file in c#
thanks
Manoj Nair
 
Back
Top