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

Edited 5 Years Ago by Reverend Jim: n/a

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.

This article has been dead for over six months. Start a new discussion instead.