1. 程式人生 > 程式設計 >bat 批量提取指定目錄下的檔名

bat 批量提取指定目錄下的檔名

下面是批量獲取指定目錄下的檔名的核心程式碼

@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 ..

如下是sql server執行對應指令碼檔案

sqlcmd -Spcserver -dmaster -Usa -PcrexPT84B -i 指令碼檔案

由上面兩個命令就可以寫出批量執行一個資料夾下面的所有指令碼檔案了。