If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Rate Thread | Display Modes |
#1
|
|||
|
|||
Introducing a variable into the ping command
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. |
Ads |
#2
|
|||
|
|||
Introducing a variable into the ping command
On 01/22/2018 08:28 PM, Timofei Krasniqi wrote:
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 |
#3
|
|||
|
|||
Introducing a variable into the ping command
Of recent note Mike Easter wrote:
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. |
#4
|
|||
|
|||
Introducing a variable into the ping command
Timofei Krasniqi wrote:
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 |
#5
|
|||
|
|||
Introducing a variable into the ping command
Timofei,
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. 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. 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 |
#6
|
|||
|
|||
Introducing a variable into the ping command
In message , R.Wieser
writes: Timofei, 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. 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. 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)Ar@T+H+Sh0!:`)DNAf Who's General Failure & why's he reading my disk? (Stolen from another .sig) |
#7
|
|||
|
|||
Introducing a variable into the ping command
On Tue, 23 Jan 2018 04:28:19 +0000 (UTC), Timofei Krasniqi wrote:
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. 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. |
#8
|
|||
|
|||
Introducing a variable into the ping command
On 1/22/2018 11:28 PM, Timofei Krasniqi wrote:
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. 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 |
#9
|
|||
|
|||
Introducing a variable into the ping command
Of recent note JJ wrote:
@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 Date: Tue, 23 Jan 2018 Newsgroups: alt.windows7.general,microsoft.public.windowsxp.ge neral 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 |
#10
|
|||
|
|||
Introducing a variable into the ping command
Of recent note Mike Easter wrote:
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 |
#11
|
|||
|
|||
Introducing a variable into the ping command
Of recent note Zaidy036 wrote:
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. |
#12
|
|||
|
|||
Introducing a variable into the ping command
Of recent note Timofei Krasniqi wrote:
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). |
#13
|
|||
|
|||
Introducing a variable into the ping command
Of recent note Timofei Krasniqi wrote:
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 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! |
#14
|
|||
|
|||
Introducing a variable into the ping command
On 23 Jan 2018, Timofei Krasniqi wrote
in alt.windows7.general: 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 he http://gnuwin32.sourceforge.net/packages/wget.htm There are newer versions around. An alternative utility is Curl. |
#15
|
|||
|
|||
Introducing a variable into the ping command
Nil wrote:
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 |
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|