Jump to content

Ping utility via Command Prompt


Go to solution Solved by JLogan3o13,

Recommended Posts

I have a ping utility i created to ping various equipment in my Retail Store environment

User just puts in the Store # and the click check marks for the items they wanted to ping It sets a ping with a -t so it continues indefinable..

My issue is when I hit <ctrl> + c to end it the dos window closes right away so you cant see the results.

Any ideas how to keep the dos window from closing after stopping the pinging and showing results..

Don't want to just hit <ctrl> + <break> which will give me results but only temporarily

Func PingIt()

    $SecondOct = StringLeft($Store, 2)
    $ThirdOct = StringRight($Store, 2)
    $Ping_Rtr = "10." & $SecondOct & "." & $ThirdOct & ".154"
    $Ping_REG1 = "10." & $SecondOct & "." & $ThirdOct & ".1"
    $Ping_REG2 = "10." & $SecondOct & "." & $ThirdOct & ".2"
    $ping_Reg3 = "10." & $SecondOct & "." & $ThirdOct & ".3"
    $Ping_Reg4 = "10." & $SecondOct & "." & $ThirdOct & ".4"
    $ping_RemotePrt = "10." & $SecondOct & "." & $ThirdOct & ".20"
    $ping_ShopprTrak = "10." & $SecondOct & "." & $ThirdOct & ".205"
    $ping_Style = "10.1" & $SecondOct & ".1" & $ThirdOct & ".20"
    $ping_CCTV = "10.1" & $SecondOct & ".1" & $ThirdOct & ".60"
    $ping_DMX = "10.1" & $SecondOct & ".1" & $ThirdOct & ".30"
    $ping_Brt1 = "10.1" & $SecondOct & ".1" & $ThirdOct & ".41"
    $ping_Brt2 = "10.1" & $SecondOct & ".1" & $ThirdOct & ".42"
    $ping_Brt3 = "10.1" & $SecondOct & ".1" & $ThirdOct & ".43"
    $ping_Brt4 = "10.1" & $SecondOct & ".1" & $ThirdOct & ".44"
    $ping_Rtr2 = "10.1" & $SecondOct & ".1" & $ThirdOct & ".126"

    GUICtrlSetData($Group_Main, "Main Router  " & $Ping_Rtr)

    If $Reg4 = 1 Then
        Run(@ComSpec & " /c " & "ping -t -l " & $PacketSize & " " & $Ping_Reg4)
        Sleep(1000)
        WinSetTitle("C:\WINDOWS\system32\cmd.exe", "", "Store " & $Store & "  Register 4 ")
    EndIf
    If $Reg3 = 1 Then
        Run(@ComSpec & " /c " & "ping -t -l " & $PacketSize & " " & $ping_Reg3)
        Sleep(1000)
        WinSetTitle("C:\WINDOWS\system32\cmd.exe", "", "Store " & $Store & "  Register 3 ")
    EndIf
.
.
.

Thanks in advance,,,

Link to comment
Share on other sites

  • Moderators
  • Solution

In your Run line, instead of " /c" do " /k".

 

More importantly, is there a reason you're doing it this way than with the built in Ping function, which will give you the results as well? Something like this:

#include <File.au3>

$pc = InputBox("Asset tag", "Please enter the asset tag you wish to ping.")
$var = Ping($pc)
   If @error = 0 Then
      MsgBox(0, "", $pc & " located!")
   Else
      MsgBox(0, "", "Could not ping " & $pc)
   EndIf
Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Thanks !!!

What is the actually difference in  /c  -vs-  /k  ?  is there somewhere in the help I could find this?

The reason i do this I need to see actual live ping results so i can see how bandwidth behaves as i tax the connection and we use IP Translation in our scheme so if we ping a device and it times out we get a dummy ip address showing so i rename the DOS window so you know what your pinging..

Edited by goodmanjl531
Link to comment
Share on other sites

  • Moderators

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...