Jump to content
Sign in to follow this  
goodmanjl531

Ping utility via Command Prompt

Recommended Posts

goodmanjl531

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,,,

Share this post


Link to post
Share on other sites
JLogan3o13

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
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
goodmanjl531

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

Share this post


Link to post
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
Sign in to follow this  

×