Pause for X seconds in batch file?

Everyone who ever tried to automate routine tasks in windows knows that there is no sleep() program or its analogue. At least in default windows installation.

But there is quite an unexpected workaround:

ping -n 2 127.0.0.1 > nul

will stop batch execution for 2 seconds. (Replace 2 with your number for longer pause.)

Very simple and neat. Or is it?

Leave a comment

6 Comments.

  1. Dude, that is so simple, very neat, and exactly what i’m looking for. good on ya, cheers!!

  2. THANKS! Great workaround…

  3. timeout 10
    will give you a 10 second count down timer, press any key to move on imediatly

  4. Kudos Bro,
    that was just what I am looking for.
    Cheers
    Vamsi

  5. I needed that.
    Works perfect.
    thanks

Leave a Reply

Yandex Mail.ru Google LiveJournal myOpenId Flickr claimId Blogger Wordpress OpenID Yahoo Technorati Vidoop Verisign AOL


[ Ctrl + Enter ]

10 visitors online now
10 guests, 0 members
Max visitors today: 14 at 12:10 pm MST
This month: 14 at 02-05-2012 12:10 pm MST
This year: 29 at 01-23-2012 02:50 am MST
All time: 45 at 02-23-2011 09:11 am MST