Delay batch file command
PING — Pauses the batch file until the file receives a return ping from a specified computer address. This usually results in only a small delay if you ping a working address. Select a place to delay your file. You can delay a batch file at any point in the code save for after the "Exit" command if you used one.
Scroll down until you find the point at which you want to delay the file, then create a space between the code before the delay point and the code after. Type in your command. You don't need to add anything else here.
For example, typing in timeout 30 will delay your batch file for 30 seconds. Save your document as a batch file. If you haven't yet saved your document as a batch file, do the following: Click File , then click Save As Type in your file's name followed by. Click the "Save as type" drop-down box, then click All Files. Select a save location, then click Save. This causes a 2 minute delay with no output to the screen.
Not Helpful 6 Helpful Not Helpful 19 Helpful What if I want to wait less than one second? I can't just use a dot or a comma. You can use the ping command. This command, if used with a non-existent IP address, will try to talk to a non-existent computer and give up after a specified number of milliseconds. Just multiply the number of seconds by , and you're good to go.
Not Helpful 13 Helpful Make sure that you are using an invalid IP address. Not Helpful 5 Helpful 8. David Langr. Not Helpful 13 Helpful 8. Not Helpful 15 Helpful 8. Not Helpful 7 Helpful 0. Not Helpful 0 Helpful 1. You might have pressed a key before or during the timeout part. Not Helpful 0 Helpful 0. Include your email address to get a message when this question is answered. You can run your batch file on any Windows computer by double-clicking it. Download the PMSleep sources.
Download the Wait. For longer delay times especially, it would be nice to let the user know what time is left. That is why I wrote CountDown. Pressing any key will skip the remainder of the count down, allowing the batch file to continue with the next command. Download CountDown. By default it starts displaying a tooltip which will be visible for 10 seconds or any timeout specified , but the program will terminate immediately after starting the tooltip.
The icon will remain in the notification area after the timeout elapsed, until the mouse pointer hovers over it. Or more sophisticated requires CountDown. Download SystemTrayMessage.
Add a comment. Active Oldest Votes. If you need to quote the command, use another quoted string first as the window title. Improve this answer. Raihan Raihan 9, 5 5 gold badges 25 25 silver badges 43 43 bronze badges. Show 1 more comment. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
The Overflow Blog.
0コメント