@echo off if exist list.sql del list.sql /q :input cls set input=: set /p input= 請輸入要進行判斷的路徑: set "input=%input:"=%" :: 上面這句為判斷%input%中是否存在引號,有則剔除。 if "%input%"==":" goto input if not exist "%input%" goto input for /f "delims=" %%i in ('dir /b /a-d /s "%input%"') do echo @@%%~fnxi>>list.sql if not exist list.sql goto no_file start list.sql exit :no_file cls echo %cur_dir% 出現(xiàn)錯誤,未成功生成list.sql腳本! pause