ipconfig,Ping,nsloookup programs

Posted on 2003-11-21
Last Modified: 2011-10-03
Does anyone know of ways to use these applications (ipconfig,ping,nslookup) within C#. I want to use these applications in the background and don't want the user to see usage of these applications. Thanks for any help.
Question by:andyk1
  • 2
LVL 22

Expert Comment

ID: 9799816

using System.Diagnostics;

            private void DOSCommand()
                  Process myDosCmd = null;
                  ProcessStartInfo qOptions = new ProcessStartInfo("cmd.exe", @"/C net send pc-02-49 This is a text Message");
                  qOptions.RedirectStandardOutput = false;  // set to "true" to enable logging
                  qOptions.UseShellExecute = true;  // set to true to make silent/background
                  qOptions.WindowStyle = ProcessWindowStyle.Hidden;

                  myDosCmd = Process.Start(qOptions);
                  //Logging commands
//                  string dosOut = DOS.StandardOutput.ReadToEnd();
//                  Console.Write(dosOut);
LVL 22

Accepted Solution

_TAD_ earned 75 total points
ID: 9799880

The above code is for the net send command but everything else works exactly the same.

Here is the code (altered slightly) to ping my own computer (although the window is not hidden like you would expect it to be)


            private void DOSCommand()
                  Process myDosCmd = null;
                  ProcessStartInfo qOptions = new ProcessStartInfo("cmd.exe", @"/C ping pc-02-49");
                  qOptions.WindowStyle = ProcessWindowStyle.Hidden;
                  qOptions.RedirectStandardOutput = true;  // set to "true" to enable logging
                  qOptions.UseShellExecute = false;  // set to true to make silent/background
                  myDosCmd = Process.Start(qOptions);
                  //Logging commands
                  string dosOut = myDosCmd.StandardOutput.ReadToEnd();


Pinging [] with 32 bytes of data:

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

Ping statistics for

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 0ms, Average = 0ms


Expert Comment

ID: 9800185
If your interested in getting results within your program Check this link out.  Im sure there is code available for IpConfig / NSLookup Type Programs.

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Email Body 4 46
What is MicroStrategy.NET? 2 45
Problem to open Excel file 15 43
Events in static methods 3 25
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now