我有一个Windows批处理文件,它可以执行以下操作:
for %%s in (*.sql) do call
It loops through all the sql script in a folder.
In the folder the file names are like:
s4.06.01.sql
s4.07.01.sql
s4.08.01.sql
s4.10.01.sql
s5.01.sql
但是for循环随机遍历文件(不按名称顺序),首先运行s5.01,然后是s4.06,s4.08,s4.10,最后是s4.07。 如何让它们按名称顺序运行?
以前可以正常工作,现在却不行了。可能是什么原因导致这个问题?
for /f "usebackq" %%s in (
dir *.sql /b /ON) do call
。 - Patrick Cufftokens=
,像这样:for /f "usebackq tokens=" %%s in (
dir "my work dir\*.sql" /b /ON) do call
。 - Alexander Gelbukh