It looks like you are trying to use DOS commands to create a batch file that executes (a) other batch files or (b) executes SQLCMD to run a sql or sql script.
Here are a few examples that are all rolled into one. I use the DOS START command with the /WAIT switch, which will support your original "main" batch file running in one window and execute the next file or commands in a new window. This new window remains open until the script finishes and exits.
Some of ECHO are probably not required, but the script will show you a little.
@echo off
So this is pretty simple in the sense that you are just running the script. If you use script1.bat, you can return the error back to the main script and terminate it immediately. I was unclear if this is what you need for the script wizard.
echo Starting Database Update. echo. echo Excuting Script 1 echo. start /wait C:\path\to\your\script1.bat echo If there was a problem, break here. Pause echo Excuting Script 2 echo. start /wait C:\path\to\your\script2.bat echo If there was a problem, break here. Pause
It uses the same START / WAIT to start SQLCMD, which in this case simply returns the query results. It should be noted here that -Q (uppercase) starts the request and exits. If you use -Q (lowercase), it will run the query and open in SQLCMD, waiting for another query.
echo. echo Running SQLCMD: "select top 100 * from sys.objects" start /wait sqlcmd -S (local) -Q "select top 100 * from sys.objects"
And this is how you can run the sql script, which means -i , but I also did not run it in START / WAIT, as before. Not exactly what you need, but I wanted to show both examples. It also shows that -b will terminate the batch process if your script returns an error, which is useful if you use several scripts that depend on the success of the previous (s).
echo. echo Running SQLCMD from an (-i)nput file: sqlcmd -S (local) -i C:\path\to\your\script.sql -b echo. echo Update Complete. pause End
So, I assumed that you are looking for a .bat or .cmd file that uses SQLCMD. The example I gave is pretty simple, but hopefully it sets you on the right path.
IT! And remember that CTRL + C breaks the script package in the process.