A very nice article on sqlcmd

https://www.simple-talk.com/sql/sql-tools/sql-server-sqlcmd-basics/