Below I will show you the most basic example of using sqlcmd to run multiple sql scripts from command line.
In my example I will use server name locahost which I will shorten to . which is the same as localhost.
I have created a batch file in folder and I put two script in the same folder script1.sql and script2.sql
To run both script I put the following two lines inside my batch script.
sqlcmd -s. -i ".\script1.sql"
sqlcmd -s. -i ".\script2.sql"
You can also run multimple script one on line using this example
sqlcmd -s. -i ".\script1.sql", ".\script2.sql"
-s switch follow by . means that script will execute on localhost
-i ".\script1.sql" shows the location of sql file that I want to execute. In this case I use relative path .\ which means that it will take the file from the same folder where the path file is located.
I'll try to add screenshots later on.
I hope this blog post helps you to use sqlcmd and run multiple sql scripts