The help file states for the DO command (seems to be copy/paste from every other command like DIR):
For me (using latest TCC on Win10 x64) this is buggy with DO because /o:a seems to be the default - which can cause havoc if you expect getting the same order like with DIR (where /o:n seems to be the correct default) and don't set the /o: switch explicitly.
My output is:
/O:... Sort the files before processing.
n Sort by filename and extension, unless e is explicitly included. This is the default.
a Sort names and extensions in standard ASCII order, instead of numerically when numeric substrings are included in the name or extension.
For me (using latest TCC on Win10 x64) this is buggy with DO because /o:a seems to be the default - which can cause havoc if you expect getting the same order like with DIR (where /o:n seems to be the correct default) and don't set the /o: switch explicitly.
Code:
@echo off
@echo off
touch /cq "Test 1.txt"
touch /cq "Test 2.txt"
touch /cq "Test 10.txt"
echo ... default
do test in Test*.txt
echo %test%
enddo
echo ... /o:n
do test in /o:n Test*.txt
echo %test%
enddo
echo ... /o:a
do test in /o:a Test*.txt
echo %test%
enddo
My output is:
Code:
... default
Test 1.txt
Test 10.txt
Test 2.txt
... /o:n
Test 1.txt
Test 2.txt
Test 10.txt
... /o:a
Test 1.txt
Test 10.txt
Test 2.txt