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

Strange DO behavior with /O

Discussion in 'Support' started by dim, Jan 7, 2016.

  1. dim

    dim Dimitry Andric

    Joined:
    May 31, 2008
    Messages:
    203
    Likes Received:
    0
    I am running Take Command 19.00.28. I just ran into a rather strange behavior of the DO command, in combination with the /O option. Suppose that you create a C:\Test directory, and a bunch of random subdirectories under it:
    Code:
    md C:\Test
    cdd C:\Test
    md Foo Bar Baz
    
    The directory will look somewhat like this:
    Code:
    2016-01-07  22:59         <DIR>    Bar
    2016-01-07  22:59         <DIR>    Baz
    2016-01-07  22:59         <DIR>    Foo
    
    Now save the following in a btm file, say "test.btm":
    Code:
    @echo off
    echo Enumerating directory without /o:
    do i in /a: *.*
      echo Found: %i
    enddo
    echo Enumerating directory with /o:
    do i in /a: /o:ne *.*
      echo Found: %i
    enddo
    
    If you run test.btm, the first DO loop will enumerate everything, but the second will stop at the first entry! The output is:
    Code:
    Enumerating directory without /o:
    Found: Bar
    Found: Baz
    Found: Foo
    Found: test.btm
    Enumerating directory with /o:
    Found: Bar
    
    I am pretty sure that it worked OK in Take Command 18, but maybe something was always incorrect in the way the second DO command was invoked? Or is this a new bug?

    Please enlighten me. :)
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    It looks pretty good here.
    Code:
    c:\test> test.btm
    Enumerating directory without /o:
    Found: Bar
    Found: Baz
    Found: Foo
    Found: test.btm
    Enumerating directory with /o:
    Found: Bar
    Found: Baz
    Found: Foo
    Found: test.btm
    
    c:\test> dir /k /m /h
    2016-01-07  17:35  <DIR>  Bar
    2016-01-07  17:35  <DIR>  Baz
    2016-01-07  17:35  <DIR>  Foo
    2016-01-07  17:32  178  test.btm
    
    c:\test> type test.btm
    @echo off
    echo Enumerating directory without /o:
    do i in /a: *.*
      echo Found: %i
    enddo
    echo Enumerating directory with /o:
    do i in /a: /o:ne *.*
      echo Found: %i
    enddo
     
  3. Alpengreis

    Joined:
    Jan 12, 2014
    Messages:
    242
    Likes Received:
    6
    I have the same behaviour as dim ...

    EDIT: Also here the same Win 10 as Dimitry ...
     
    #3 Alpengreis, Jan 7, 2016
    Last edited: Jan 7, 2016
  4. dim

    dim Dimitry Andric

    Joined:
    May 31, 2008
    Messages:
    203
    Likes Received:
    0
    Just as a data point, this is on Windows 10 [Version 6.3.10586], and using an NTFS filesystem. Vince, you ran your test on Windows 7?
     
  5. Alpengreis

    Joined:
    Jan 12, 2014
    Messages:
    242
    Likes Received:
    6
    Also "funny" is this ...

    Code:
    [C:\Users\alpen\Downloads\_Temp_]dir /k /m /h
    07.01.2016  23:58         <DIR>    Bar
    07.01.2016  23:58         <DIR>    Baz
    07.01.2016  23:58         <DIR>    Foo
    08.01.2016  00:32             131  test2.btm

    test2.btm
    Code:
    @echo off
    cdd c:\users\alpen\downloads\_Temp_
    echo Enumerating directory with /o:
    do i in /A:D /O:-D *.*
      echo Found %i
    enddo
    Code:
    [C:\Users\alpen\Downloads\_Temp_]test2.btm
    Enumerating directory with /o:
    Found Foo
    Found Baz
    
     
  6. dim

    dim Dimitry Andric

    Joined:
    May 31, 2008
    Messages:
    203
    Likes Received:
    0
    Right, version 19.00.19 fixes this issue for me. Thanks Rex.
     

Share This Page