Ameba Ownd

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

Windows batch programmierung sleep

2022.01.19 01:57




















Is this intended to become a canonical? If so then some explanatory text might be appropriate. Most, if not all, canonical questions I've seen include text describing the intent of that question.


Or some text explaining the situation It's mostly to help with SEO, but also helps to frame potential Answers. SEO working just fine. First hit for me on Google search. Show 1 more comment. Active Oldest Votes. Improve this answer. Community Bot 1. The timeout command does not work with Windows XP even with the Resource kit installed and the sleep command does not work in Windows 7 so the ping command can still be of good use if you are using the batch file on both Win7 and WinXP.


For the record, this works fine in Windows 10 b Unfortunally Windows XP has no native timeout or choice — Radon Add a comment. This is not made-up, it really is an address with the sole purpose of not-existing it may not be clear, but it applies even in local networks : Please don't do that, even if it's slightly better than pinging a real address.


Ping is simply the wrong tool for the job. Massimo It's most likely not what it was intended to do : But I think it's a good solution still - it does work better than timeout in some scenarios in particular higher resolution. Also, it's become quite well known, so most people would not be very surprised i. Massimo Alright! I guess we just have different views. If you don't mind I'll still leave this answer up since it seems to be better than pinging localhost n times as is most often described.


What use is a command that fails just because input is redirected? Show 2 more comments. Works like a charm.


This solution has worked for me in Win10, in an unattended. Wish I could upvote this answer a few more times. Worked perfectly in my unattended script. The command: ping While it will work it's the equivalent of driving a screw with a hammer.


A wrong tool may work, but it's still wrong. MarkAllen - technically you then have to worry about whether or not ping comes with your OS. If you're worried enough about '95 '98 or ME then you should be as equally worried about 6. In PowerShell you can use Start-Sleep when you need a time delay. The delay can be specified either in seconds default or in milliseconds.


The following batch code uses PowerShell to generate a delay:. Or if you want to allow fractions of seconds:. Note that starting PowerShell. Use the SysSleep function whenever you need a time delay in Rexx scripts. Use the Sleep command for time delays in KiXtart scripts. Use WScript. The following batch code uses a temporary VBScript file to generate an accurate delay:. Or if you want to allow the user to skip the delay:. Jacob Jacob 47 1 1 bronze badge. On Windows 10 it gives numbers from to 49, as it should.


Did it ever really do otherwise? Why would you use goto when you can have one liners like above? Other solutions let you explicitly specify the range. What is the advantage of your code? Community Bot 1 1 1 silver badge. Sinji58 Sinji58 37 1 1 bronze badge.


Yan Yan 1, 17 17 silver badges 19 19 bronze badges. And just to be completely random for those who don't always want a black screen. Nerdroid I think that is broken — A Child of God. The Overflow Blog. Stack Gives Back Safety in numbers: crowdsourcing data on nefarious IP addresses. Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually.


Linked 1. See more linked questions.