.bat (batch) file delay?

Discussion in 'Programming' started by pcz, Nov 16, 2009.

  1. #1
    Anybody knows how to set a delay in a batch file?

    Haven't had success with the choice command (I don't that one doesn't work in XP).

    What I want is a delayed action of the batch file.
     
    pcz, Nov 16, 2009 IP
  2. organicCyborg

    organicCyborg Peon

    Messages:
    330
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use the pause comment to stop the file until the user presses a key. I believe there is a pause function available, but you need to download some additional software from Microsoft to get it working (I believe it's called Microsoft Services for UNIX).

    A quick google search revealed this hack:
    
    ECHO Waiting 5 seconds
    PING 127.0.0.1 -n 1 -w 5000 > NUL
    
    Code (markup):
     
    organicCyborg, Nov 16, 2009 IP
  3. inpun

    inpun Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    The command is "pause".
    It will print "Press any key to continue..."
     
    inpun, Nov 17, 2009 IP