Bat batch extracts the file names under the specified directory


The following is the core code for batch obtaining the file name under the specified directory

@echo off
echo text input

set input=
set /p input=:
echo %input% is input
cd %input%
rem @echo on
for %%a in (*) do (
  echo %%a is input

cd ..

The following is the script file executed by SQL server

Sqlcmd – spcserver – dmaster – USA – pcrexpt84b – I script file

By the above two commands, you can write out all the script files under a folder in batch.