开发者

Find all sql files using bat

How to find all the sql files inside a folder and get the file names using a batch file? I have tried like:

for /f %%a IN (‘dir "C:\SQLFILES\ *.sql"’) do echo %%a

开发者_如何学运维

But I am not getting the proper output.


for %%a in (*.sql) do echo %%a

or

for %%a in (c:\sqlfiles\*.sql) do echo %%a

Just read your update. To call another batch file you need:

for %%a in (c:\sqlfiles\*.sql) do call myotherbatch.cmd %%a

If you don't call the batch file then control will be transferred over for good, there won't be a return from the child script.

Also, batch files are now .cmd files. .bat is legacy.


How about

cd C:SQLFILES
dir /b /s *.sql
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜