SQLCMD can run a startup script defined by the environment variable SQLCMDINI.
Suppose you want to always execute the following query when you are connected to the server:
SELECT @@SERVERNAME, @@VERSION
Place this command inside the init.sql file and define the following environment variable:
C:\SET SQLCMDINI=c:\sqlscripts\init.sql
Then whenever you start a SQLCMD session, the script automatically executes and displays query output listing the server name and full version string.