When I am running this from cmd on my SQL Server 2008 instance:
sqlcmd -U sa -S mymachinen_name\\MSSQLSERVER
(where MSSQLSERVER
MSSQLSERVER
I encountered this error trying to connect to the server through Jenkins and resolved it this way:
sqlcmd -e -S "SERVER_NAME,PORT_NUMBER" -U %USER% -P %PASSWORD% -i "D:\\test.sql"