Ameba Ownd

アプリで簡単、無料ホームページ作成

Windows ping wait time

2022.01.17 01:46




















Acceptable values are from 0 to If 0 is specified, there will be no pause and the default choice is selected.


If not specified, the utility displays only a prompt. Displays this help message. The first choice listed returns a value of 1, the second a value of 2, and so on. If the user presses a key that is not a valid choice, the tool sounds a warning beep. Adam Porad Adam Porad This site computerhope. Works fine. Oh man The command is greate, but unfortunally not native in windows XP. But you can simply copy the choice.


Add a comment. The following hack let's you sleep for 5 seconds ping -n 6 OldMcDonald 11 11 silver badges 33 33 bronze badges. This should be -n 6. Otherwise you just wait 4 seconds. Remember that ping waits 1 second between pings, so you always have to specify one more try than you need. This is a much better solution than pinging a presumed non-existing IP, which by the way fails when network is down.


Pinging localhost almost always works. If you've got PowerShell on your system, you can just execute this command: powershell -command "Start-Sleep -s 5" Edit: people raised an issue where the amount of time powershell takes to start is significant compared to how long you're trying to wait for.


Subtract get-date. Niall Connaughton Niall Connaughton Simply loading up PowerShell takes a few seconds. I ended up using this myself. Running the plain 5 second sleep takes about 5. Using the second script I posted gets the inaccuracy down to around 20 - 30 milliseconds. If you need more accuracy than this, I doubt you'll get it from the ping approach either.


NiallConnaughton Can you test with —NoProfile and see how much that affects the speed? Apparently there are 6 potential profiles that PowerShell will try to load if you don't pass -NoProfile. On my current system, there's a ms cost to starting powershell, and -noprofile isn't improving that.


However, this machine is not on a corporate domain with a roaming profile, etc. Good suggestion. Show 3 more comments. Alex Alex 1 1 gold badge 5 5 silver badges 8 8 bronze badges. Chris Marisic Not sure how to use it, but it doesn't seem to fit the bill. Not what I was looking for here, but thanks for this one anyway - it'll come in useful later. Show 1 more comment. If you are connected to the internet the best solution would be: ping 1.


Alex Nolasco Jonathan Jonathan 5 5 silver badges 8 8 bronze badges. Pinging to 1. It causes network traffic. Ping to localhost instead. The point of pinging an unreachable IP address is to cause the command to wait for a response and timeout after the specified time.


Why not use something like I've seen it used many times as a very bad example of an "unreachable" address. I shudder to think of all the scripts that suddenly broke when Cloudflare started responding to pings on 1.


Amir Amir 1, 15 15 silver badges 24 24 bronze badges. Sorry, but I have to downvote an answer that assumes the unreachability of 1. Ned Martin Ned Martin 5 5 silver badges 12 12 bronze badges. There is! There IS a sleep command in vanilla windows. It solely depends on which edition of Windows you're running. I have upvoted this as it is a valid solution. The answer should provide accurate information on what version s of windows it works on.


It just depends on what features and roles you have included in the configuration of your server. To specifically get access to the sleep command, install the Windows Resource Kit. This automatically installed by enabling one among the few features that require it in the Server Manager. So, you can make your monitoring solution as complex or as easy as you like.


We find even the most elementary monitoring system is a step in the right direction, at least some administrator is keeping any eye on machines If you can scan your subnet or part of it without triggering security alarms, and don't mind a bit of extra data, Angry IP Scanner is fast, free, lets you click to sort by status, and can provide more detailed information.


Why not launch ping in the background, with output to a temporary file, in parallel for every host? Then sleep for one second, kill any ping processes that are still running, and read the files to collect the output.


The timeout is an integer value indicating how far and long the packet can be sent. Values below 1 are meaningless. A value of 1 indicates you are pinging immediate neighbors only. The only way to speed things up is to run a background check and harvest the results. This is what tools like Nagios do. On macOS, to set the time ping waits for a response form the server before deciding its a non-response timeout is -t :.


Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. How can I set a short timeout with the ping command? Ask Question. Asked 11 years, 2 months ago.


Active 9 months ago. Viewed k times. So, my script launches a single ping for each host: ping -c 1 So I tried this: ping -c 1 -W 1 I tried to set it to below a second, but it does not seem to take the parameter into account at all: ping -c 1 -W 0.


If not, are there any alternatives? Edit The O. The hosts I am trying to ping are actually access points. They are on the same vlan and subnet as the users for simplicity of deployment and replacement. This is why I do not want to scan all the subnet with a ping -b for example. Edit 2 I accepted the fping solution thanks for all the other answers. Learn more.


How can I perform a ping every X minutes and check the response time? Ask Question. Asked 10 years, 3 months ago. Active 1 month ago.


Viewed k times. This is happening in a process control system, and is unacceptable Open a valve sometimes take 2 minutes before command start I want to double-check when the network team says "everything is alright on the network". I am not a batch expert, but do you think this code is correct to use? Improve this question. Zoredache I cannot install such softwares on a Process control computer: dev. Add a comment. Active Oldest Votes. Just replace timeout with the following hack: ping Improve this answer.


Profete, do you have the sleep command then? If so, just replace timeout with sleep. What version of Windows are you doing this? Same for sleep Profete, old school! Why is there need a file? Show 1 more comment. Abdu 3 3 bronze badges. Still, bash on Windows seems to be the best option Sean Vikoren Sean Vikoren 2 2 silver badges 9 9 bronze badges. If the request timed out ping error appears whatever IP address you test, it indicates that your network adapter settings might corrupt.


Here are the detailed steps. Step 2 : Input the following commands one by one and press Enter after each:. Windows Firewall helps to filter information from the Internet and prevent potentially harmful programs from accessing your system. However, sometimes Windows Firewall might prevent your computer from receiving ICMP Echo replies to your ping, which is another reason for request timed out ping cmd. To solve the problem, you can try disabling Windows Firewall temporarily and check whether the ping command works again.