1.

Solve : Pausing Help?

Answer»

Is there a way to pause for a certain amount of time in MS-DOS?
i seen something SIMILAR to this here the other day

ping 1.1.1.1 -i 10 >nul


change the number 10 for amount of seconds to timeout , i dont think its entirely accurate..I have learnt it USING this way (still by ping):

QUOTE

ping -n 2 -w 1000 1.1.1.1 >nul


Still, it is quite hard to get the timing accurate, so you may have to play around a bit with the -n variable.Oh, here's another way that you can pause (slightly more accurately I believe):

Quote
ping -n 1 -w 1000 1.1.1.1 >nul
echo 3
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 2
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 1
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo.
echo 0

Except replace 3 with whatever number you want. You don't even have to include the numbers if you want.does

PING Insert 7=(8-1) second delay

work?
i always use it is should work.
i suppose..Quote from: Sharamall on October 20, 2007, 08:01:11 PM
Is there a way to pause for a certain amount of time in MS-DOS?



Another option - - use a third party utility program.

ftp://ftp.simtel.net/pub/simtelnet/msdos/batchutl/

ftp://ftp.simtel.net/pub/simtelnet/msdos/batchutl/wait.zip

Examples are in the included Readme.txt file.

Does this work in Windows 2000?

Sorry, I meant the syntaxes earlier in the thread. And they do work, so sorry for the spam.Quote from: Sharamall on October 21, 2007, 01:15:21 PM
Does this work in Windows 2000?

Without a quote, I'm guessing you are asking about wait.zip ?


I don't know for sure about W2K, since I can't test it on that os.
Since it is free, and the file is small and will d/l in a very short time, your best bet is to simply grab a copy and try it.
As a matter of fact, after you do, please do come back here and post and let others know if it ran ok on W2K or not.


By the way, your original post:
Quote
Is there a way to pause for a certain amount of time in MS-DOS?
specified MS-DOS, not W2K. Quote from: Sharamall on October 21, 2007, 01:15:21 PM
Does this work in Windows 2000?

Sorry, I meant the syntaxes earlier in the thread. And they do work, so sorry for the spam.
you can use sleep command, or create your own sleep..using vbscript
Code: [SELECT]wscript.sleep(5000) 'sleep 5 secs
save the above as myscript.vbs , usage :
Code: [Select]@echo off
rem ..my dos commands
cscript /nologo myscript.vbs
rem after sleeping 5 secs
or
you can create the script on the fly in your batch...using echo to file
Code: [Select]....
echo wscript.sleep(5000) > myscript.vbs
cscript /nologo myscript.vbs
..
del myscript.vbs
Yes, those are all awesome and they work (I tested them). Now I need shutdown to work...I reopened this thread because I wanted to ask a question about the timed pause that was posted above. The ping thing: ping -n 1 -w 1000 1.1.1.1 >nul for example. But I thought ping sent a message to an IP address and waited for a response from that computer. So how does it work here? (Basically, explain why the syntax works)Here is how it works:
ping -n 1 -w 1000 1.1.1.1 >nul

You're sending 1 echo request (aka ping). -n 1
Code: [Select]-n count Number of echo requests to send.
With a timeout of 1 second. -w 1000
Code: [Select]-w timeout Timeout in milliseconds to wait for each reply.
To a nonexistent IP. 1.1.1.1

And >nul hides the text output from Ping.

So you're pinging an IP that doesn't exist and telling Ping to wait 1 second for a reply that will never come.

So since the the IP doesn't exist, after the timeout (which happens to be 1000 milliseconds) ping stops trying, and moves to the next operation? Awesome, I get it!


Discussion

No Comment Found