Windows 8 and 8.1 Forums


Trivia question: max value for -w in ping command?

  1. #1


    Posts : 2,130
    Windows 8.0 x64

    Trivia question: max value for -w in ping command?


    Trivia question: max value for -w in ping command? I don't mean the max wait a ping can experience. I just mean the maximum value after -w on the command line that will not give an error. If they use a 32 bit integer then it's pretty big. But if it's only 16 bit maybe we're limited to 64k?

    ping 127.0.0.1 -n 2 -w 50000 > nul
    --------------------------^^^^


    edit: I haven't found an answer on bing so I'm just curious if anyone knows.

    edit2: for the purpose of this trivia let's limit it to W8 command line .. not Linux or OS/2 or whatever.

      My System SpecsSystem Spec

  2. #2


    England, Northamptonshire
    Posts : 536
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard


    I'm not entirely sure what the maximum is but what I believe you are trying to do is to set a wait period in a batch file?

    For a wait out period I set the timeout period to 1000 (1 Second) and then use the count trigger to determine the amount of seconds to wait.

    For example:

    ping 127.0.0.1 -n 300 -w 1000 >nul

    I set this command to wait 1 second between each ping and then repeat that 300 times. 300 Seconds = 5 minutes

    Just a thought, I'll try and see if there is a maximum value...

    EDIT: Just found out that the timeout switch will only come into effect if a ping destination is not reachable. Since a loopback address will always respond the timeout will not take effect. Try to ping a destination address that does not exist and it will. For example, sending a ping to 172.16.0.1 should fail since it is a private IP address and chances are that you will not have one on a home network. The timeout between each ping will then take affect. As a test I decided to try a timeout of a massive number and appears to be working so I am not entirely sure of the max value:

    Click image for larger version

    Now that I know this I am going to change some scripts I had to allow the 1 second timeout between each ping...

    Josh
    Last edited by Shadowjk; 16 Nov 2013 at 09:52. Reason: Added notes
      My System SpecsSystem Spec

  3. #3


    Posts : 2,130
    Windows 8.0 x64


    I should have used the line from a post that made me ask this question instead of the localhost address
    ping 192.0.2.2 -n 1 -w 60000 > nul

    (the page example used only 6000 for six seconds per 'n' : I made it 60000)

    According to the page where I found this line that address is supposedly defined as unreachable by standard.

    I used such a high number of milliseconds because the user wanted a delay of minutes. I figured if I made the number after -n equal to minutes it would be easier to understand.

    I'm just curious what the threshold of ms is. I suspect it's at least 32 bit signed integer but you never know with command line legacy code. I'm glad I searched on it because I was using ping for seconds delay with the 127 address too in my batches.
      My System SpecsSystem Spec

  4. #4


    England, Northamptonshire
    Posts : 536
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard


    192.0.2.2 would be a public IP address so someone may have it on the internet or it may not be used. I don't know...

    I have decided to use an autoconfiguration address that is only used when a device cannot get a DHCP offer (169.254.xxx.xxx)

    Either way, as long as it offers a timeout the parameters should be met

    Josh
      My System SpecsSystem Spec

  5. #5


    Posts : 2,130
    Windows 8.0 x64


    Here's where I got the IP address:
    scripting - How to wait in a batch script? - Stack Overflow

    He quotes some RFC that guarantees it won't exist. All I know is I did nslookup and got "non existent domain"
      My System SpecsSystem Spec

  6. #6


    England, Northamptonshire
    Posts : 536
    Windows 8.1 Pro 64-bit ; Windows Server 2012 R2 Standard


    Hmmm... I didn't know that! Cheers for the link
      My System SpecsSystem Spec

  7. #7


    Posts : 2,130
    Windows 8.0 x64


    I didn't actually look at the RFC. I took his word for it.
      My System SpecsSystem Spec

Trivia question: max value for -w in ping command?
Related Threads
I use sysprep tool to reset my computer. And I successfully boot into windows desktop. The problem is that I can't use Internet , chrome ,IE, Skype ,all programs are offline ,but the strange part is ,I can ping Windows 8 Forum ,which means my network and dns is ok. And I can't even go to...
Windows 8.1 - Disabling Ping in System Security
Hello everyone, I am was reading about how DNS on local machines can actually help malware. So I wanted to disable DNS on my local machine completely. That is to say when I execute ping www.google.com from cmd.exe I should get the message could not resolve. How do I do this...
Ping spikes to 300+ occasionally in Network & Sharing
Hi, I am on a laptop and when I leave my laptop on for an extended period of time, the ping suddenly spikes to 300+ when I'm playing games and whatnot. Internet is completely unusable when it reaches that problem. I'm pretty sure that my laptop is the problem because whenever that happens, I just...
Solved ping command in General Support
in which folder can i find ping command
Cannot ping gateway in Network & Sharing
Sometimes happens that I cant ping gateway (same address as router(dhcp server)) but I get address from it. Then only restart helps. Shutdown doesn't help. I tried ipconfig /release -> ipconfig /renew after that I get IP from 10.0.0.1 but I cannot ping it back. OS: Windows 8
Did anyone ever notice ...... The "Quick Links" menu (Logo + X or right-click lower left corner) contains a "File Explorer," but it opens the "Computer" folder instead of "Libraries." https://www.eightforums.com/tutorials/4503-power-user-tasks-menu-open-windows-8-a.html
Hi folks, I am a developer and I have recently released my quiz "Ingenify" for the Windows 8 App Store. You can find it here: Ingenify (Trivia Quiz) app for Windows in the Windows Store (English version - Windows 8 - all platforms) The German Android version, which was the version with...
Eight Forums Android App Eight Forums IOS App Follow us on Facebook