CREATE_ALL.bat ECHO OFF REM 请设定下面内容 REM SET Driver=C: REM SET FilePath=C:/Data Base/ SET User_ID=sa SET User_PWD=qwerty SET ServerName=codinghand/sqlserver2008 SET HostName=codinghand SET DBName=GroggeryDB
SET Next=------------------------------------------ SET CommandStr=osql -U %User_ID% SET CommandStr=%CommandStr% -P %User_PWD% SET CommandStr=%CommandStr% -S %ServerName% SET CommandStr=%CommandStr% -H %HostName% SET CommandStr=%CommandStr% -d %DBName% SET CommandStr=%CommandStr% -i %FilePath%
REM %Driver% REM CD %FilePath% REM 执行指定目录中的所有的sql文件 for %%i in (*.sql) do call CREATE_ALL_File.bat %%i ECHO SQL文件执行完成,请确认上面的执行结果。 pause
---------------------------------------------------------------- CREATE_ALL_File.bat SET FileName=%1 ECHO %1 SET CommandStrTB=%CommandStr%%FileName% ECHO %CommandStrTB% %CommandStrTB% ECHO . ECHO %Next%