• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 127204
  • Last Modified:

Creating a Wait command for a batch file.

I found the below article on another site (Link provided at the bottom of my post) Essentially it talks about creating a wait command however when I follow the directions it says that " "CHOICE" is not a recognized internal or external command, operable program or batch file. " and will not wait the number of seconds that I need.  Any help would be greatly appreciated.

-------- THE BELOW WAS FOUND ON: http://malektips.com/dos0017.html ----------

SUMMARY: Make your batch files wait for a specified number of seconds before continuing. Works in DOS and Windows.

Do you need a batch file that waits a certain amount of seconds? In some languages, the command would be WAIT, but DOS and Windows do not come with this command for batch files. If you want to implement the WAIT command, create the following batch file and name it WAIT.BAT.

@CHOICE /T:N,%1% >  NUL

Now, in order to wait 10 seconds in a batch file, just call the WAIT.BAT batch file as follows:


-------------------------------------------- BREAK ---------------------------------------------
  • 2
3 Solutions
Dufo G. BelskiRetired bureaucrat/desktop supportCommented:
The rest of the article: However, if you are running Windows NT, Windows 2000, or Windows XP, you can use the following WAIT.BAT, as the CHOICE command is not included in the default install:

@ping -n 2 -w 1000
@ping -n %1% -w 1000

The reason for the two lines is that in order to wait using the PING command, you must add extra pings to correctly wait the desired number of seconds. Also, since the PING command is being used, it is possible that this WAIT batch file may run over a few milliseconds. Thus, it is not recommended to use this for critical real-time processing.
Dufo G. BelskiRetired bureaucrat/desktop supportCommented:
Choice.exe is available in the NT, 2000, and, presumably XP, resource kits.
What operating system are you using?
asyscokid has a viable work around for you, but if you're looking for choice.com - simply copy it from an older system or download the supplement that includes this command here: http://support.microsoft.com/?kbid=117600

Alternatively, you may be interested in sleep.exe
Download it here: http://www.computerhope.com/dutil.htm
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now