Strange DO behavior with /O

dim

Dimitry Andric
May 31, 2008
204
1
Netherlands
#1
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
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
 

dim

Dimitry Andric
May 31, 2008
204
1
Netherlands
#4
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
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