title: Select after login via Batch (Microsoft SQL Server Management Studio)
body: <p>I am trying to select data from table and save them info .csv file via .bat file. 
  My batch runs Microsoft SQL Server Management Studio and log me into database, but I am not able to execute sql scripts.
  Here is what I have:</p>
  
  <pre><code>    @echo off
      cls
      :begin
      set /p SName=Server Name :
      set /p DbName=Database Name :
      set /p UName=User Name :
      set /p DbPWD=Password :
      pause
      echo Running Microsoft SQL Server Management Studio, please wait
      call ssms -S %SName% -d %DbName% -U %UName% -P %DbPWD% "select * from MYTABLE" -s "," -o " Export.csv"        
      echo Done
      pause
      :end
  </code></pre>
  
  <p>It does not work after line: <code>ssms -S %SName% -d %DbName% -U %UName% -P %DbPWD%</code></p>
  
  <p>UPDATE:
  <a href="https://i.stack.imgur.com/fRxCH.png" rel="nofollow noreferrer">Error picture</a></p>
  
  <p>Thank you</p>