title: SQLCMD within a VBS
body: <p>I am trying to write a section into a script which attaches a DB via SQLCMD.</p>
  
  <p>If I run this from a CMD line/batch file it attaches the DB successfully:  </p>
  
  <pre><code>sqlcmd -U sa -P RubbishPassword -S (local) -Q "sp_attach_db 'MyDBInstance','D:\AFolder\MyDB.mdf','D:\MyDBInstance\MyDB_log.ldf'"
  </code></pre>
  
  <p>However if I run it within a VBS by doing the below it doesn't error but doesn't attach the DB.</p>
  
  <pre><code>    Set objShell = CreateObject("WScript.Shell")
  objShell.Run "sqlcmd -U sa -P RubbishPassword -S (local) -Q ""sp_attach_db 'MyDBInstance','D:\AFolder\MyDB.mdf','D:\MyDBInstance\MyDB_log.ldf'" 
  </code></pre>
  
  <p>Any ideas on why and/or a better way of passing a SQLCMD via VBS?</p>