I was thinking of making a program which creates a console in which it sends a ping to an domain, in this case "www.google.com". then read this into my vb application. Probably looking to read each line into a listbox, this way i can add a parser to only take the data i want.

Thankyou for your replies

I did exactly the same thing this summer to troubleshoot a problem with my Rogers Rocket Hub at the cottage. Do you have a question? You don't require a CMD session to execute the ping. A simple (simple enough for my purposes) ping function is

Private Function PingStatus(ByVal addr As String) As String
    Try
        Return IIf(My.Computer.Network.Ping(addr), "UP", "DOWN")
    Catch ex As Exception
        Return "DOWN"
    End Try
End Function

Yeah thats a simple piece of code but theres 2 reason i want to read from CMD. 1. i kinda wana know if it can be done, and if so i would like to have that knowledge just in case i ever need it. 2. i have batch file which pings google which returns the time taken for the ping to be returned, i use this to see how fast my network is running which is very useful.

Would like to convert this batch file into a visual basic application. is there a way of doing it that way?

Someone else on the forum posted this code. It may help.

Dim cmdProcess As Process

cmdProcess = New Process()
' Dump all info from ipconfig command
cmdProcess.StartInfo.Arguments = "/ALL"
' Run command: ipconfig
cmdProcess.StartInfo.FileName = "ipconfig"
' Redirect stdout
cmdProcess.StartInfo.RedirectStandardOutput = True
' Set to false, otherwise you can't redirect stdout
cmdProcess.StartInfo.UseShellExecute = False
' Start process
If cmdProcess.Start() Then
    ' Read stdout and show the content in a rtf-box
    RichTextBox1.Text = cmdProcess.StandardOutput.ReadToEnd
Else
    ' Failed to execute command
End If

As for converting the batch file, post it and I'll have a look.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.