Computing.Net > Forums > Disk Operating System > Pause a batch file for 10 sec'

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Pause a batch file for 10 sec'

Reply to Message Icon

Name: Borg
Date: November 5, 2001 at 23:52:52 Pacific
Comment:

Hi,

Does anybody know how to stop a batch file for 10 sec' or so....

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: DoOMsdAY
Date: November 6, 2001 at 03:49:27 Pacific
Reply:

Check out the "choice" command. It'll look something like this: "choice /c:x /t:10" where 'x' is your exit key.


0

Response Number 2
Name: A.H.
Date: November 7, 2001 at 07:32:18 Pacific
Reply:

Not exactly, Doomsday!

Add this line to your batch file

CHOICE /C:x /T:x,10 > NUL

Now, when the batch has executed to this line it will hold for ten seconds, unless you press the 'x' key (change it to anything you want). The "> NUL" at the end does that "[X]?" etc doesnt display.


0

Response Number 3
Name: DoOMsdAY
Date: November 7, 2001 at 09:30:12 Pacific
Reply:

Oops, yeah, I forgot about the default selection for when timeout occurs - the thing before the ',' and after the '/t:'. Plus the NUL is a nice touch for clean output. Thanks A.H.


0

Response Number 4
Name: Laurence
Date: November 8, 2001 at 13:05:56 Pacific
Reply:

Batfiles: The DOS batch file programming handbook & tutorial


12. A timed delay which can not be interfered with from the keyboard.
:: Substitute 5 with the desired number of seconds, up to 99.
TYPE nul |CHOICE.COM /N /CY /TY,5 >nul

12a. Timed delay w/o pipe.
CHOICE.COM/N/CY/TY,5nul

12b. Timed delay with Ctrl+C and Ctrl+Break disabled.
@ECHO off
CTTY nul
TYPE nul |CHOICE.COM /N /CY /TY,5
CTTY con

http://home7.inet.tele.dk/batfiles/main/batricks.htm


0

Response Number 5
Name: Norm
Date: April 1, 2002 at 11:13:14 Pacific
Reply:

how do you pause a batch file in a NT environment that doesn't have choice.com? thanks!
Norm


0

Related Posts

See More



Response Number 6
Name: Pete
Date: April 5, 2002 at 06:09:18 Pacific
Reply:

For NT, you need sleep.exe, which comes with the resource kits for NT 4, Windows 98, and Windows 2000. Then you can simply invoke a non-interruptible pause as follows:

sleep 5

where the integer is the number of seconds you wish to pause for.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Pause a batch file for 10 sec'

Can you execute a batch file for a web page www.computing.net/answers/dos/can-you-execute-a-batch-file-for-a-web-page-/5382.html

Reading input from a batch file www.computing.net/answers/dos/reading-input-from-a-batch-file/13892.html

checking a file date to execute a batch file www.computing.net/answers/dos/checking-a-file-date-to-execute-a-batch-file/1909.html