Discussion:
Introducing a variable into the ping command
(too old to reply)
Timofei Krasniqi
2018-01-23 04:28:19 UTC
Permalink
What is quick (efficient) way to ping various {a,b,c} servers?

When I switch networks, which I do frequently, it's not always easy to tell
that I'm "on" the new network - so - I ping until the ping starts
responding, and when the network goes down, the ping stops responding.

No big deal, right? It's simple stuff:

Start > Run > %windir%\system32\cmd.exe /K "C:\Windows\System32\PING.exe -t www.google.com"

But sometimes I want to ping some other main server, not just google.

Is there a way to introduce a variable into that equation easily?

a = google.com
b = microsoft.com
c = apple.com
etc.
Mike Easter
2018-01-23 05:29:42 UTC
Permalink
Post by Timofei Krasniqi
What is quick (efficient) way to ping various {a,b,c} servers?
ICMP ping isn't the best tool to use to 'touch' a (each and every)
server; some servers don't 'like to' echo ICMP pings.

Steve Gibson's ID Serve works better. https://www.grc.com/id/idserve.htm

That remark doesn't solve your automating variable servers issue, it is
just about 'what's wrong with/ limiting about/ ping (for this purpose)?'
--
Mike Easter
Timofei Krasniqi
2018-01-23 05:54:58 UTC
Permalink
Post by Mike Easter
Steve Gibson's ID Serve works better. https://www.grc.com/id/idserve.htm
Thanks for the hint.

I tested idserve manually, and while I like the audible clicks, it doesn't
seem to repeatedly check the server to see if the network is "alive".

Start > Run > %windir%\system32\cmd.exe /K "C:\Program Files\idserve\idserve.exe 207.46.230.219"
It's completely manual. Click. Click. Click click click. Click. Click.

Is there a way to make it loop easily?
Actually, all I need is a click when the network connects and a bong when
it disconnects.

I would think everyone would benefit from such a program.
Mike Easter
2018-01-23 06:28:51 UTC
Permalink
Post by Timofei Krasniqi
Actually, all I need is a click when the network connects and a bong when
it disconnects.
Here's a tool:

http://www.nirsoft.net/utils/multiple_ping_tool.html PingInfoView is a
small utility that allows you to easily ping multiple host names and IP
addresses, and watch the result in one table. It automatically ping to
all hosts every number of seconds that you specify, and displays the
number of succeed and failed pings, as well as the average ping time.
You can also save the ping result into text/html/xml file, or copy it to
the clipboard.
--
Mike Easter
Timofei Krasniqi
2018-01-23 20:26:19 UTC
Permalink
Post by Mike Easter
http://www.nirsoft.net/utils/multiple_ping_tool.html PingInfoView is a
small utility that allows you to easily ping multiple host names and IP
addresses, and watch the result in one table. It automatically ping to
all hosts every number of seconds that you specify, and displays the
number of succeed and failed pings, as well as the average ping time.
You can also save the ping result into text/html/xml file, or copy it to
the clipboard.
Thank you Mr. Easter for that very nice help!
To give back for others to learn by reading what I did by doing, I agree
this tool also has promise when set up similarly to JJ's pinger.bat file.

Start > Run > pinginfoview > OK
or
Start > Programs > Network > PingInfoView.lnk

Especially as pinginfoview can do a few things the batch file doesn't.
(PingInfoView) Options > Beep on Failed Pings (Default = C:\WINDOWS\Media\tada.wav)
(PingInfoView) Options > Advanced Options > Execute the following command on failed ping:
(PingInfoView) File > Ping Options > Address list to ping: www.google.com
(PingInfoView) File > Ping Options > Ping again every [30] seconds
(PingInfoView) File > Ping Options > Ping Timeout (in ms): [1000]
(PingInfoView) File > Ping Options > Ping Size (in bytes): [32]
(PingInfoView) File > Ping Options > Start pinging immediately without displaying this dialog box
Timofei Krasniqi
2018-01-23 22:40:30 UTC
Permalink
Post by Timofei Krasniqi
Thank you Mr. Easter for that very nice help!
BTW, I realize this pushes the goalpost further past the endzone, and hence
maybe it's a separate question, but is there a way to get the
'whatismyipaddress.com' from this command line?

With that addition, the network would be proved working *and* the actual
network would be known (because it could be the wrong network working).
Nil
2018-01-23 23:10:35 UTC
Permalink
Post by Timofei Krasniqi
BTW, I realize this pushes the goalpost further past the endzone,
and hence maybe it's a separate question, but is there a way to
get the 'whatismyipaddress.com' from this command line?
I retrieve my external IP address once a day from

http://www.nirsoft.net/show_my_ip_address.php

using wget to download a copy of that web page. I then use FINDSTR and
PERL to parse that page and write my IP address to a log file. I've
been doing this for a few years because I became curious about how
often my ISP changes my address.

The Nirsoft page only lists my IPv4 address. Your whatismyipaddress
page only lists my IPv6 address. Now I'm starting to wonder if my IPv6
address changes independently of my IPv4 address. I'll have to figure
out how to add that to my log.

So, the answer to your question is, "yes, you can," or at least you
could if WGET didn't object to the SSL certificate of that web site. It
does seem to have a lot of spammy 3rd-party ads on it. But otherwise,
you can use wget, a commandline file downloader. This is a unix/linux
utility ported to Windows. There are a few versions of it around. The
one I'm using came from here:

http://gnuwin32.sourceforge.net/packages/wget.htm

There are newer versions around.

An alternative utility is Curl.
Mike Easter
2018-01-24 03:41:11 UTC
Permalink
Post by Nil
An alternative utility is Curl.
I like

curl icanhazip.com

in linux.

The WAN IP result is 'clean' and free of any html.

I believe there are Win32 & Win64 available as well.

https://curl.haxx.se/download.html
--
Mike Easter
Char Jackson
2018-01-24 05:20:30 UTC
Permalink
Post by Timofei Krasniqi
Post by Nil
An alternative utility is Curl.
I like
curl icanhazip.com
in linux.
The WAN IP result is 'clean' and free of any html.
Nice find. That's about as clean as anything I've seen.

# curl icanhazip.com
170.22.86.205

Or this, to see a little more about what's happening:

# curl -v icanhazip.com
* About to connect() to icanhazip.com port 80 (#0)
* Trying 69.162.69.148... connected
* Connected to icanhazip.com (69.162.69.148) port 80 (#0)
Post by Timofei Krasniqi
GET / HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.1l zlib/1.2.3 libidn/1.18
Host: icanhazip.com
Accept: */*
< HTTP/1.1 200 OK
< Server: nginx
< Date: Wed, 24 Jan 2018 05:14:57 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 15
< Connection: close
< X-SECURITY: This site DOES NOT distribute malware. Get the facts.
https://goo.gl/1FhVpg
< X-RTFM: Learn about this site at http://bit.ly/icanhazip-faq and do
not abuse the service.
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: GET
<
170.22.86.205
* Closing connection #0
--
Char Jackson
Timofei Krasniqi
2018-01-24 06:01:47 UTC
Permalink
Post by Char Jackson
Nice find. That's about as clean as anything I've seen.
# curl icanhazip.com
170.22.86.205
What I like about the curl is that it will be unambiguous that the network
changed.

1) On network 1, the curl will return the network 1 IP address.
2) If that network socket stays constant, you're kosher.
3) But if the network drops back, accidentally, to your ISP...
4) Then the curl "should" show a *different* IP address instantly.
Right?

If so, then using curl should be enough to tell that the network 1 failed,
dropping you back to your ISP. Right?

Now the trick will be to get "curl" working on Windows.
<https://stackoverflow.com/questions/9507353/how-do-i-install-set-up-and-use-curl-on-windows#16216825>
<https://thecustomizewindows.com/2012/07/installing-curl-in-windows-to-run-curl-commands-natively/>
Timofei Krasniqi
2018-01-24 06:51:30 UTC
Permalink
Post by Timofei Krasniqi
Now the trick will be to get "curl" working on Windows.
To give back, I documented it working up to steps #14 and #15 below.
In step 14, the cmd window goes away when we run "curler.bat".

What do we need to add to JJ's batch file to keep the cmd window open?

1) Visit the curl download-wizard page: https://curl.haxx.se/dlwiz/
2) Select the "Type of Package: curl executable"
3) Select the "Operating System: Win64"
4) Select for "What Flavour: Generic"
5) Select which "Win64 version: Any"
6) Select for "What CPU: x86_64"
7) You end up with the download link:
https://bintray.com/artifact/download/vszakats/generic/curl-7.57.0-win64-mingw.7z
8) Unpack "curl-7.57.0-win64-mingw.7z" to ".\curl-7.57.0-win64-mingw\"
9) Test it quickly:
Start > Run > %windir%\system32\cmd.exe /K "C:\path\curl\bin\curl.exe icanhazip.com"
10) Make a curl.lnk shortcut to ".\curl-7.57.0-win64-mingw\bin\curl.exe"
11) Move that shortcut to Start > Programs > Scripts > curl.lnk
12) Edit the shortcut target from "C:\path\curl\bin\curl.exe"
to Target = %windir%\system32\cmd.exe /K "C:\path\curl\bin\curl.exe icanhazip.com"
Comment = Reports current WAN IP address
13) Test that shortcut:
Start > Programs > Scripts > curl.lnk
14) Create a batch file "C:\path\curl\bin\curler.bat"
(based on JJ's previous suggestion)
REM Run the curl command to get your IP address
@echo off
setlocal
set n=%1
if "%n%" == "" (
set /p "n=Enter host/IP (leave empty for icanhazip.com): "
)
if "%n%" == "" set n=icanhazip.com
curl %n%

HELP: This works - but the window disappears instantly.
How do we make the window remain?

15) Create a new "App Path" 'String' key so that "Start Run" works.
Start > Run > curler > OK

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\curler.exe
(Default) = C:\path\curl\bin\curler.bat

Note that "curler.exe" is just an arbitrary name which must end with
".exe" where an actual file "curler.exe" should not actually exist.

In step 14 above, the command window goes away when we run "curler.bat".
What do we need to add to JJ's batch file to keep the cmd window open?
Nil
2018-01-24 08:08:24 UTC
Permalink
Post by Timofei Krasniqi
In step 14 above, the command window goes away when we run
"curler.bat". What do we need to add to JJ's batch file to keep
the cmd window open?
PAUSE
Timofei Krasniqi
2018-01-24 16:48:47 UTC
Permalink
Post by Timofei Krasniqi
In step 14 above, the command window goes away when we run
"curler.bat". What do we need to add to JJ's batch file to keep
the cmd window open?
PAUSE
Thank you for that help.
Inserting a trailing "pause" worked perfectly.

Only one thing left to mimic the original "ping" question with "curl" which
is to loop it forever (which "ping -t" did).

I'll look for the "-t" option in the copious results from:
curl.exe --help > curl.help.txt
curl.exe --manual > curl.man.txt

Huh? I just went through every line of curl.help.txt and there's no option
to keep doing it. That's strange. Let me look at the manpage.

Hmmm.... the "-retry" seems to be the closest analog to "pint -t" but the
retry option in curl seems to only be for errors.

Did I miss something?
Does curl have the equivalent of a "ping -t" which repeats the command?
Char Jackson
2018-01-24 18:46:27 UTC
Permalink
On Wed, 24 Jan 2018 16:48:47 +0000 (UTC), Timofei Krasniqi
Post by Timofei Krasniqi
Only one thing left to mimic the original "ping" question with "curl" which
is to loop it forever (which "ping -t" did).
curl.exe --help > curl.help.txt
curl.exe --manual > curl.man.txt
Huh? I just went through every line of curl.help.txt and there's no option
to keep doing it. That's strange. Let me look at the manpage.
Hmmm.... the "-retry" seems to be the closest analog to "pint -t" but the
retry option in curl seems to only be for errors.
Did I miss something?
Does curl have the equivalent of a "ping -t" which repeats the command?
On your Linux host, you could wrap it in 'watch':

watch -n60 curl icanhazip.com
--
Char Jackson
Timofei Krasniqi
2018-01-25 02:01:35 UTC
Permalink
Post by Char Jackson
watch -n60 curl icanhazip.com
Linux is always easy compared to Windows for batch scripting.

This should work though.
<https://stackoverflow.com/questions/2591758/batch-script-loop#2591782>

This was tested to work, where it will report the IP address every second
for 100 seconds when I hit "Start > Run > curler > OK".

@echo off
goto actual
set /a loopcount=0
:actual
set /a loopcount=%loopcount% + 1
C:\path\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
if %loopcount%== 100 goto stop
goto actual
:stop
exit
Timofei Krasniqi
2018-01-25 06:40:30 UTC
Permalink
Post by Timofei Krasniqi
This was tested to work, where it will report the IP address every second
for 100 seconds when I hit "Start > Run > curler > OK".
Slowly I'm realizing, belatedly, that the right approach is something like
this flow chart.

1. Save your original ISP IP address (which we'll call OLD_IP)
2. Switch networks and run curl and save the NEW_IP
3. Keep running curl, comparing the IP address
4. The moment the IP address changes - you ring an alarm
Char Jackson
2018-01-25 13:55:10 UTC
Permalink
On Thu, 25 Jan 2018 02:01:35 +0000 (UTC), Timofei Krasniqi
Post by Timofei Krasniqi
This was tested to work, where it will report the IP address every second
I'd be hesitant to hit it every second because of the note (in a header)
from the site admin:

X-RTFM: Learn about this site at http://bit.ly/icanhazip-faq and do not
abuse the service.

I don't know what he considers abuse. At least you're stopping after a
finite number of hits.
Post by Timofei Krasniqi
for 100 seconds when I hit "Start > Run > curler > OK".
@echo off
goto actual
set /a loopcount=0
:actual
set /a loopcount=%loopcount% + 1
C:\path\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
if %loopcount%== 100 goto stop
goto actual
:stop
exit
I think I'd swap these two lines.
Post by Timofei Krasniqi
goto actual
set /a loopcount=0
Or better yet, just remove that instance of "goto actual". It looks
superfluous.
--
Char Jackson
Timofei Krasniqi
2018-01-25 14:55:45 UTC
Permalink
Post by Char Jackson
I think I'd swap these two lines.
Post by Timofei Krasniqi
goto actual
set /a loopcount=0
Thanks for that advice, as that seems to work fine.
@echo off
REM curler.bat {Returns IP address to doublecheck network status}
REM WIP MUST = add a *compare* of the NEW_IP with the OLD_IP & ring alarm
REM WIP SHOULD = figure out how to put the time & the same line as IP
REM WIP COULD = get a hours:minutes:seconds time stamp
REM goto actual
set /a loopcount=0
goto actual
:actual
set /a loopcount=%loopcount% + 1
time /T
C:\apps\browser\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
goto actual
if %loopcount%== 100 goto stop
:stop
exit
Post by Char Jackson
Or better yet, just remove that instance of "goto actual". It looks
superfluous.
Thanks for following the logic, as I don't really understand this stuff.
That works fine too!

@echo off
REM curler.bat {Returns IP address to doublecheck network status}
REM WIP MUST = add a *compare* of the NEW_IP with the OLD_IP & ring alarm
REM WIP SHOULD = figure out how to put the time & the same line as IP
REM WIP COULD = get a hours:minutes:seconds time stamp
REM goto actual
set /a loopcount=0
:actual
set /a loopcount=%loopcount% + 1
time /T
C:\apps\browser\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
goto actual
if %loopcount%== 100 goto stop
:stop
exit
Char Jackson
2018-01-25 18:48:06 UTC
Permalink
On Thu, 25 Jan 2018 14:55:45 +0000 (UTC), Timofei Krasniqi
Post by Timofei Krasniqi
Post by Char Jackson
I think I'd swap these two lines.
Post by Timofei Krasniqi
goto actual
set /a loopcount=0
Thanks for that advice, as that seems to work fine.
@echo off
REM curler.bat {Returns IP address to doublecheck network status}
REM WIP MUST = add a *compare* of the NEW_IP with the OLD_IP & ring alarm
REM WIP SHOULD = figure out how to put the time & the same line as IP
REM WIP COULD = get a hours:minutes:seconds time stamp
REM goto actual
set /a loopcount=0
goto actual
:actual
set /a loopcount=%loopcount% + 1
time /T
C:\apps\browser\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
goto actual
if %loopcount%== 100 goto stop
:stop
exit
Post by Char Jackson
Or better yet, just remove that instance of "goto actual". It looks
superfluous.
Thanks for following the logic, as I don't really understand this stuff.
That works fine too!
@echo off
REM curler.bat {Returns IP address to doublecheck network status}
REM WIP MUST = add a *compare* of the NEW_IP with the OLD_IP & ring alarm
REM WIP SHOULD = figure out how to put the time & the same line as IP
REM WIP COULD = get a hours:minutes:seconds time stamp
REM goto actual
set /a loopcount=0
:actual
set /a loopcount=%loopcount% + 1
time /T
C:\apps\browser\curl\bin\curl.exe icanhazip.com
timeout 1 /nobreak>nul
goto actual
if %loopcount%== 100 goto stop
:stop
exit
Looks like it'll loop forever now. Somehow, these two lines got swapped
with each other. They need to be in the opposite order so that you check
the value of the variable (and optionally skip to ":stop" before jumping
back to the top at ":actual".
Post by Timofei Krasniqi
goto actual
if %loopcount%== 100 goto stop
--
Char Jackson
Nil
2018-01-26 02:58:26 UTC
Permalink
Post by Char Jackson
I'd be hesitant to hit it every second because of the note (in a
X-RTFM: Learn about this site at http://bit.ly/icanhazip-faq and
do not abuse the service.
I don't know what he considers abuse. At least you're stopping
after a finite number of hits.
Yes, Please, OP, don't hammer his site like that. He's doing us all a
favor, one which I am now taking advantage of once a day. Hitting a web
site every second starts to look like a DOS attack and would NOT be
appreciated by anyone. He will be able to block your requests but it
will still affect his service negatively.
Char Jackson
2018-01-26 05:29:02 UTC
Permalink
On Thu, 25 Jan 2018 21:58:26 -0500, Nil
Post by Nil
Post by Char Jackson
I'd be hesitant to hit it every second because of the note (in a
X-RTFM: Learn about this site at http://bit.ly/icanhazip-faq and
do not abuse the service.
I don't know what he considers abuse. At least you're stopping
after a finite number of hits.
Yes, Please, OP, don't hammer his site like that. He's doing us all a
favor, one which I am now taking advantage of once a day. Hitting a web
site every second starts to look like a DOS attack and would NOT be
appreciated by anyone. He will be able to block your requests but it
will still affect his service negatively.
"This is why we can't have nice things." :-)
--
Char Jackson
Nil
2018-01-24 08:12:41 UTC
Permalink
Post by Timofei Krasniqi
I like
curl icanhazip.com
in linux.
The WAN IP result is 'clean' and free of any html.
I like that, too! You can get both the IPv4 and 6 addresses. Cool!
Thanks for the tip.
Post by Timofei Krasniqi
I believe there are Win32 & Win64 available as well.
https://curl.haxx.se/download.html
R.Wieser
2018-01-23 07:17:38 UTC
Permalink
Timofei,
Post by Timofei Krasniqi
Is there a way to introduce a variable into that equation easily?
Nope, not when using it that way.

But what about using a couple of shortcuts ? Than its becomes as easy as
clicking one.
Post by Timofei Krasniqi
Is there a way to make it loop easily?
If you want more control over what happens, you could use a batch (.bat) or
maybe even a VBScript (.vbs) file.
Post by Timofei Krasniqi
Actually, all I need is a click when the network connects and a bong when
it disconnects.
... especially whe you want to do something like that.

For the batch file you could append a "find" to your command testing for the
connected/disconnected result (the result will be in the "errorlevel"
variable, which you can test).

Pseudo code (for both a batch or VBScript solution)

do a single ping and check for OK result
If not, jump to previous line
Play a 'click' sound
do a single ping and check for failed result
If not, jump to previous line
Play a 'bong' sound
jump to first line

Regards,
Rudy Wieser
J. P. Gilliver (John)
2018-01-23 12:06:15 UTC
Permalink
Post by R.Wieser
Timofei,
Post by Timofei Krasniqi
Is there a way to introduce a variable into that equation easily?
Nope, not when using it that way.
But what about using a couple of shortcuts ? Than its becomes as easy as
clicking one.
Post by Timofei Krasniqi
Is there a way to make it loop easily?
If you want more control over what happens, you could use a batch (.bat) or
maybe even a VBScript (.vbs) file.
Post by Timofei Krasniqi
Actually, all I need is a click when the network connects and a bong when
it disconnects.
... especially whe you want to do something like that.
For the batch file you could append a "find" to your command testing for the
connected/disconnected result (the result will be in the "errorlevel"
variable, which you can test).
Pseudo code (for both a batch or VBScript solution)
do a single ping and check for OK result
If not, jump to previous line
Play a 'click' sound
do a single ping and check for failed result
If not, jump to previous line
Play a 'bong' sound
jump to first line
Regards,
Rudy Wieser
I would suggest some waits in there, otherwise (a) it _might_ impact
your network (and CPU, though only marginally) usage (b) it might
irritate the owners of the hosts you're pinging.

Both of these are almost certainly unimportant, but on principle, I'd
put them in. Either that or select hosts (at least for the fail test)
that are slow to respond, if any such exist.
--
J. P. Gilliver. UMRA: 1960/<1985 MB++G()AL-IS-Ch++(p)***@T+H+Sh0!:`)DNAf

Who's General Failure & why's he reading my disk? (Stolen from another .sig)
JJ
2018-01-23 12:39:40 UTC
Permalink
Post by Timofei Krasniqi
What is quick (efficient) way to ping various {a,b,c} servers?
When I switch networks, which I do frequently, it's not always easy to tell
that I'm "on" the new network - so - I ping until the ping starts
responding, and when the network goes down, the ping stops responding.
Start > Run > %windir%\system32\cmd.exe /K "C:\Windows\System32\PING.exe -t www.google.com"
But sometimes I want to ping some other main server, not just google.
Is there a way to introduce a variable into that equation easily?
a = google.com
b = microsoft.com
c = apple.com
etc.
You can use a batch file that prompts for the server name to ping. e.g.

@echo off
setlocal
set n=%1
if "%n%" == "" (
set /p "n=Enter host/IP (leave empty for www.google.com): "
)
if "%n%" == "" set n=www.google.com
ping -t %n%

You can create a shortcut file to the batch file and directly pass the
server name, so that it won't ask for the server name. Use that shortcut for
your main pinger. The command line for the shortcut should be e.g.

pinger.bat www.google.com

Create another shortcut file without specifying the server name, and use
that when you need to ping another server.
Timofei Krasniqi
2018-01-23 19:58:15 UTC
Permalink
Post by JJ
@echo off
setlocal
set n=%1
if "%n%" == "" (
set /p "n=Enter host/IP (leave empty for www.google.com): "
)
if "%n%" == "" set n=www.google.com
ping -t %n%
This worked perfectly!
Thank you so very much for helping me and others at the same time.

To give back in return, here is a quick step by step tutorial
that should work if people just cut and paste what is below.

This solution will be archived for posterity to:
<http://tinyurl.com/microsoft-public-windowsxp-gen>

1) Obtain the pinger batch script courtesy of
From: JJ <***@vfemail.net>
Date: Tue, 23 Jan 2018
Newsgroups: alt.windows7.general,microsoft.public.windowsxp.general
<https://groups.google.com/forum/#!topic/microsoft.public.windowsxp.general/ACEjdOaZU_o>

2) Create the "pinger.bat" script in your scripts directory:
@echo off
setlocal
set n=%1
if "%n%" == "" (
set /p "n=Enter host/IP (leave empty for www.google.com): "
)
if "%n%" == "" set n=www.google.com
ping -t %n%

3) Creat a new "App Path" 'String' key so that "Start Run" works perfectly:
Start > Run > pinger > OK

HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\pinger.exe
(Default) = C:\path\scripts\pinger.bat

Note that "pinger.exe" is just an arbitrary name which must end with
".exe" where an actual file "pinger.exe" should not actually exist.

4) Create a shortcut to pinger.bat in your start menu hierarchy:
Start > Programs > Scripts > pinger.bat.lnk
(Press return to take the default.)

Or, change the shortcut to automatically ping the desired server:
Change target from: Target = C:\path\scripts\pinger.bat
Change target from: Target = C:\path\scripts\pinger.bat www.google.com

Comment: Syntax: {pinger.bat} or {pinger.bat www.google.com}

Use Model:
To check the network using your start menu:
Start > Programs > Scripts > pinger.lnk

To check the network using your Run command:
Start > Run > pinger > OK
Timofei Krasniqi
2018-01-23 22:56:07 UTC
Permalink
Post by Timofei Krasniqi
Start > Programs > Scripts > pinger.lnk
Start > Run > pinger > OK
I found, in testing, a huge flaw in the Nirsoft method! :(

The "socket" for the pinger method hangs, which is what you want!
<Loading Image...>

But, for whatever reason, Nirsoft just picks up with the "new" socket!
<Loading Image...>

Unless that propensity to pick up where Nirsoft left off is able to be
turned off, it makes the NirSoft method useless because it's "reliable".

What we want is a tool to detect the network change!
Timofei Krasniqi
2018-01-24 06:01:49 UTC
Permalink
Post by Timofei Krasniqi
I found, in testing, a huge flaw in the Nirsoft method! :(
The "socket" for the pinger method hangs, which is what you want!
<http://i.cubeupload.com/Uk2KfP.jpg>
But, for whatever reason, Nirsoft just picks up with the "new" socket!
<http://i.cubeupload.com/IZ7UPh.jpg>
Unless that propensity to pick up where Nirsoft left off is able to be
turned off, it makes the NirSoft method useless because it's "reliable".
What we want is a tool to detect the network change!
Oh oh. I may have made a mistake above.
I really do not understand this "socket" stuff, and, yes, I've googled it
and I have never found a simple explanation that I really understand.

Anyway, it appears the only reason the ping hung up was because I
highlighted a line so I could tell if it was moving, and *that* hung the
ping up, not the socket.

So, both the ping and Nirsoft are "too good" in that they "recover" from a
lost socket connection, which isn't what I want.

When the network *changes*, I want the ping or Nirsoft to fail.

The ping just happily pings using the *new* socket, which isn't what I
want.

At least Nirsoft, which also starts using the *new* socket, shows a
momentary *red spot* if you're lucky, where it skips a connection but all
that depends on the frequency of test.

Darn. Maybe the "curl" of "icanhazip.com" on Windows is better because it
would at least report a *different IP address* when the connection changes.

But where is the tutorial to get curl working on Windows?
Zaidy036
2018-01-23 17:23:44 UTC
Permalink
Post by Timofei Krasniqi
What is quick (efficient) way to ping various {a,b,c} servers?
When I switch networks, which I do frequently, it's not always easy to
tell that I'm "on" the new network - so - I ping until the ping starts
responding, and when the network goes down, the ping stops responding.
Start > Run > %windir%\system32\cmd.exe /K "C:\Windows\System32\PING.exe -t www.google.com"
But sometimes I want to ping some other main server, not just google.
Is there a way to introduce a variable into that equation easily?
a = google.com
b = microsoft.com
c = apple.com
etc.
Would "Choice" cmd in batch help? Or use a batch to call ChangePing xxx
where xxx is server name with a default specified within batch or error
note.
--
Zaidy036
Timofei Krasniqi
2018-01-23 20:35:39 UTC
Permalink
Post by Zaidy036
Would "Choice" cmd in batch help? Or use a batch to call ChangePing xxx
where xxx is server name with a default specified within batch or error
note.
The ideal network-switch checker, given the observation that it takes a
minute or two for the network switch to take effect (empirical observation)
would be the following user sequence.

A) User switches to new network (knowing it takes a minute or two and
sometimes fails).

B) User initiates the JJ pinger or Mike pinginfoview method.

C) User doesn't want to wait watching the paint dry, so the user does a few
things in the foreground.

D) When the network is established, a "success" beep is heard in the
background.

E) If the network fails (it happens a lot), a "fail" beep is heard in the
background.

Note that the success beep is actually more important than the fail beep
because of two different reasons.

1) The user doesn't want to watch the grass grow waiting for a successful
connection, so they just "do stuff" in the foreground until the success
beep is heard in the background.

2. The user will notice a failure of the network because the socket will
"hang" when the network drops.

So a success beep is more important, in an efficient use model, than the
failure beep.

Unfortunately, PingInfoView seems to only do stuff on failures.
I don't see a way to add a single success beep yet.

Note that you don't want a million success beeps. Just one.
Continue reading on narkive:
Loading...