Close Menu
    Facebook X (Twitter) Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook X (Twitter) Instagram
    TecAdmin
    You are at:Home»Windows Tutorials»How to Add Sleep/Wait in Windows Batch Script

    How to Add Sleep/Wait in Windows Batch Script

    By RahulJune 29, 20181 Min Read

    You can use timeout command to wait for command prompt or batch script for the specified amount of time. The time is defined in Seconds.

    For example to wait for 5 seconds use. Use /T options:

    c:/> timeout /T 5
    

    You can also specify seconds directly like:

    c:/> timeout 5
    

    The above commands will break the timeout process on pressing any key. You can use /NOBREAK ignore key presses and wait for the specified time.

    c:/> timeout /T 5 /NOBREAK
    

    Windows XP users use sleep command instead of the timeout.

    c:/> sleep 5
    

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    A Step-by-Step Guide to Installing Nginx on Windows

    Creating Timestamped Files and Directories in PowerShell: A Step-by-Step Guide

    How to find Powershell Version via Command line

    How to Check PowerShell Version (Windows, Linux and macOS)

    View 7 Comments

    7 Comments

    1. Chris Owen on October 17, 2021 1:10 am

      I created a script to change IPs in the stack to commonly used for a project and needed a vanilla set of commands used in CMD to make the change then pause and display that the IPs had changed to the 5 needed for the project. Of Course I made a script to put the table back into DHCP mode. So using commands that wont work in every version of windows would not be advisable.
      I had been looking for a PAUSE before running the IPCONFIG and this works great.

      Reply
      • Chris Owen on October 17, 2021 1:12 am

        I also created a program that pings devices for up and down and a common device that might be on a network and since some of the replacement gear was misconfigured I also scan and alert on that issue too.

        Reply
    2. neon on October 12, 2020 3:29 pm

      `sleep’ is so much simpler and easier to use and is “native” to cmd

      :\> sleep 3

      Will sleep script/command line for 3 seconds.

      Reply
    3. viki on June 6, 2019 9:22 am

      what is command for windows 10?

      Reply
      • praveen on February 3, 2020 10:14 am

        timeout will work in window 10 as well

        Reply
    4. Matt on June 30, 2018 2:34 am

      I am using PowerShell on my system, so I just execute this command:

      powershell -command "Start-Sleep -s 5"
      

      Hope this help every one.

      Reply
    5. PJS on June 30, 2018 2:30 am

      You can use timeout as well as this will not be visible

      timeout 5 >nul

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to Execute Linux Commands in Python
    • Creating MySQL User with GRANT OPTION
    • Where to find crontab (cron) logs in Ubuntu & Debian
    • Backing Up Docker Volumes and Upload to S3
    • Difference Between Full Virtualization vs Paravirtualization
    Facebook X (Twitter) Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.