title: Command line that opens SSMS not actually logging into database
body: <p>I am trying to log in to a remote MS SQL Server 2012 by using SSMS and I'm opening SSMS via command line. When I run my command SSMS starts up and it opens my <code>.sql</code> file that I specify but it doesn't actually log in to my database. Here's the two versions of my command that I've run:</p>
  
  <pre><code>"C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe" 
       -S 172.18.211.76 -U USERNAME -P PASSWORD -nosplash "full_path_to_my_.sql_file"
  </code></pre>
  
  <p>and</p>
  
  <pre><code>"C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio\Ssms.exe"
       "full_path_to_my_.sql_file" -S 172.18.211.76 -U USERNAME -P PASSWORD -nosplash
  </code></pre>
  
  <p>Both commands start SSMS successfully and open my <code>.sql</code> file, but neither commands actually logs into my database for me. What I mean by that is that after I run my command the object explorer in SSMS looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/q8Td2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q8Td2.png" alt="enter image description here"></a></p>
  
  <p>so before I can do anything in my database I have to click on the connect icon and enter my credentials so the object explorer now looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/CNFlA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CNFlA.png" alt="enter image description here"></a></p>
  
  <p>In the past I was doing this and if I remember correctly I was able to use a command prompt to open SSMS and have it log into a database all at once but I can't find the command that I used to do it previously. If someone could help me out I'd greatly appreciate it. Thanks in advance.</p>
  
  <p>EDIT: here's the version of SSMS I'm using, just in case it's important:
  Microsoft SQL Server Management Studio  13.0.15600.2</p>