none
How to pause a batch file for 30 seconds

    Question

  • I am trying to create a SFX file for updating SEPM.

    The batch file is 

    cd\
    cd Program Files\Symantec\Symantec Endpoint Protection
    smc -stop -p *********

    cd\

    C:\>xcopy %temp% "C:\Program Files\Symantec\Symantec Endpoint Protection" /h /r /y

    cd\

    cd Program Files\Symantec\Symantec Endpoint Protection
    smc -start


    But I want to wait 30 seconds before starting the service (smc -start).

    Please help.


    Friday, February 19, 2010 7:05 PM

Answers

All replies

  • How about adding a line - "sleep 30" - inside the bat file at the relevant place?

    Thanks,

    Bhaskar
    Friday, February 19, 2010 7:58 PM
    Moderator
  • Hi,

    You can use :   ping -n 30 ip_adress 
    for exemple ping -n 30 127.0.0.1

    Also, you can use other methods. For more information : http://www.robvanderwoude.com/wait.php

    Thank's.
    Bechir Gharbi. MCP, MCSA, MCSE M+S, MCITP Server/Enterprise Administrator, MCT, MCTS Configuration Manager/Forefront
    Friday, February 19, 2010 8:06 PM
  • Hi Bhaskar,

    It is showing an error 

    'sleep' is not recognized as an internal or external command,
    operable program or batch file.

    Note: OS is XP Professional SP 3
    Friday, February 19, 2010 8:14 PM
  • If that is the case then I would try out Bechir's suggestion above to use ping.

    Thanks,

    Bhaskar
    Friday, February 19, 2010 8:54 PM
    Moderator
  • I know this is an old thread, but use

    ping -n 10 -w 1 127.0.0.1>nul so you don't see the ping message


    Computer Dr Breaking Crap then fixing it back since 1990

    Saturday, July 28, 2012 12:56 AM
  • Pretty sure you can use the TIMEOUT command, something like TIMEOUT /T 30.

    Not sure if it is part of XP, it is definitely part of the resource kit


    My Microsoft Core Infrastructure & Systems Management blog - blog.danovich.com.au

    • Proposed as answer by danovich_ Monday, July 30, 2012 1:09 AM
    Monday, July 30, 2012 1:09 AM
  • I think TIMEOUT works for Windows 7 and Vista.
    For previous versions i found it doesn't, so i use ping
    Thursday, July 04, 2013 1:38 PM
  • get sleep.exe from windows resource kit.

    if you want to sleep for 30 seconds, then

    sleep.exe 30

    job done.

    Friday, July 05, 2013 4:56 AM
  • worked for me. Thanks1
    Sunday, March 09, 2014 12:00 AM