@echo off sqlcmd -U mkohrer -S 10.50.30.68 -b -e -i sqlcmdtest.sql 2> error.log if %errorlevel% neq 0 ( echo There was an error running the script. Please check the error.log file for more information. ) else ( echo The script ran successfully. )