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
精彩评论