Strange DO behavior with /O

dim

Dimitry Andric
May 31, 2008
205
1
Netherlands
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. :)
 
May 20, 2008
11,404
99
Syracuse, NY, USA
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
205
1
Netherlands
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?
 
Jan 12, 2014
426
7
Switzerland, SO
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
 
Similar threads
Thread starter Title Forum Replies Date
Jesse Heines Strange Line Wrapping Behavior Support 14
N Fixed Strange dir behavior Support 6
P Strange mouse behavior with list Support 2
M Strange behavior... Support 2
vefatica Strange behavior reloading SHRALIAS sav files. Support 1
S Strange CHKDSK behavior Support 6
R strange bug? Support 7
F strange results Support 9
M Strange error messages from TCC in FTP copy Support 7
M Another possibly strange remote registry issue Support 5
forbin Strange handling of [nonbright] magenta background (v22) Support 2
vefatica REGDIR, strange error message Support 7
T WAD Strange Unexpected "features" in the Debugger Support 2
vefatica Strange tcc.exception.log Support 7
vefatica A strange one Support 0
Glenn Bowes Strange text at startup Support 5
Steve Pitts WAD Strange output from DEL of a non-existent directory Support 7
vefatica Big numbers, strange errors Support 1
aedthuio Strange... lpksetup Support 4
CWBillow dir /4 strange Support 2
D Strange issue with FOR loop Support 15
MikeBaas Strange prob with %@replace.. Support 4
vefatica OT: strange files in %TEMP Support 10
Dan Glynhampton Documentation v15 help: Strange links in @INT topic Support 0
R WAD Strange output from "memory" command Support 1
M Yet another strange something re something called "@TCONVERT" Support 8
Roedy How to? Strange colours Support 9
M WAD Strange "Start" misbehavior... Support 10
vefatica Very strange console font corruption Support 3
Steve Pitts Strange problem with FREE Support 10
A strange error in alias Support 9
newgeekorder Debugger IDE - strange tab and parameter behaviour Support 1
Exolon Strange Prompt. Support 6
vefatica Strange folders Support 1
T Strange CPU value Support 3
J Strange error: unset /s Support 14
CWBillow Strange happenings Support 2
B Strange handling of a .BAT file Support 5
J ASSOC / FTYPE strange error message Support 3
D Strange crashes in @CRC32 and @MD5 Support 9
Charles Dye Strange output, here-doc redirection, TYPE, //UnicodeOutput=Yes Support 6
vefatica Strange results with CP 1252 Support 12
S Strange REN problem - non-English characters Support 3
dcantor Strange status in ACTIVATE command Support 0
H @XMLNODES - New behavior? Support 3
H Behavior change re piping a string to a Java program Support 1
Jay Sage Baffling Behavior With TPIPE Support 5
D Pasting Unicode data has different behavior on TCC and CMD Support 2
P "Set" command behavior - a bug? Support 3
P LOG command behavior Support 3

Similar threads