in below batch script, I expect all scripts were kept at c:\temp and they will execute one by one and reord all successful/error records in log file, if any error occours then it should stop what syntex going wrong here, one more I kept this batch script and all sql scripts in one folder only
@Echo Off
FOR /f %%i IN ('DIR C:\temp\*.Sql /B') do call :RunScript %%i
GOTO :END
:RunScript
Echo Executing %1
@set SName=someservername
@set DbName=somedbname
@set path=C:\temp
echo sqlcmd -S %SName% -d %DbName% -i %1 -o "%path%\log.txt"
if not %errorlevel%==0 exit
Echo Completed %1
:END