The following is the core code for batch obtaining the file name in 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 that executes the corresponding script file in SQL Server
sqlcmd -Spcserver -dmaster -Usa -PcrexPT84B -i script file
The above two commands can be used to write all script files under a folder in batch execution.