title: Batch file when using WinSCP and command prompt
body: <p>I am currently writing a script that calls WinSCP, connects an SFTP session, transfers a group of files from a local server to a remote server, closes the connection, then moves the local file to an archive. An alternate acceptable solution would be to copy the file to archive and then delete it from the source directory.</p>
  
  <p>The problem I am having is that I can get WinSCP to open, connect and transfer the files, but after that the commands are ignored and I am unable to automate the connection close, file move or copy and the deletion and closing of command prompt. What is the best way to do this? </p>
  
  <p>My <code>FTP.bat</code> file that connects the session and calls the script - </p>
  
  <pre><code>"C:\Program Files\WinSCP\WinSCP.exe" /console /command "lcd d:\bofa_ftp\out" /script=script.txt savedsession@winscpname.com
  </code></pre>
  
  <p>My script file that puts the file and closes the connection - </p>
  
  <pre><code>option batch abort
  option confirm off
  option exclude script.txt
  put *.txt
  close
  </code></pre>
  
  <p>When I add any commands to either the bat or the script they are ignored. </p>