title: SqlCmd :connect with variables and backslash
body: <p>When using SqlCmd to try and connect to an active server I have discovered that these both work:</p>
  
  <pre><code>:connect myServer\myInstanceName -U myLogin -P myPassword
  
  :setvar INSTANCE myInstanceName
  :connect $(INSTANCE) -U myLogin -P myPassword
  </code></pre>
  
  <p>This does not:</p>
  
  <pre><code>:setvar serv myServer
  :setvar inst myInstance
  :connect $(serv)\$(inst) -U myLogin -P myPassword
  </code></pre>
  
  <p>It throws this as a syntax error, I suspect because it thinks the back-slash is an escape character.</p>
  
  <p>Doing this doesn't help: </p>
  
  <pre><code>:connect '$(serv)\$(inst)' -U myLogin -P myPassword
  </code></pre>
  
  <p>And neither does this:</p>
  
  <pre><code>:connect $(serv)\\\\$(inst) -U myLogin -P myPassword
  </code></pre>
  
  <p>And I can't figure out how sqlCmd is supposed to concatenate variables, so I can't pass the whole thing in as a variable. If you try and set a variable like this:</p>
  
  <pre><code> :setvar serv myServer
   :setvar myVariable $(serv)\
  </code></pre>
  
  <p>Then it literally sets myVariable to be "$(serv)\" which isn't a lot of help.</p>
  
  <p>Anyone help?</p>