1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Command line DO in batch files

Discussion in 'Support' started by vefatica, Feb 19, 2011.

  1. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,794
    Likes Received:
    29
    Some of the syntaxes work. This one screws up:

    Code:
    do i=1 to 5
        echo foo
        set /a due=%_datetime + 1
        do until datetime %due ( delay /m 1 )
        echo xxx
    enddo
    "xxx" is never seen. [Note, adding 1 to a datetime doesn't work when going around "minute corners" so don't try the test above just before a new minute.]

    Oddly, you can fix it with

    Code:
        do until datetime %due ( delay /m 1 )
        enddo
        echo xxx
     

Share This Page