Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


haha - Yup that worked! Thanks for your help!

Exit WinScp Once Script Complete


First time using WinSCP and relatively new to scripting as well. Have developed a script that connects to the SFTP I need and downloads the latest text file but for some reason it doesn't exit from WinSCP so my Command Prompt window stays open after the script has run. I am using WinSCP version 5.17.5 on Windows 10.

The following is the bat file (with personal directory names and passwords removed):

cd C:\Program Files (x86)\WinSCP\ /open MyConnectionName /passphrase=MyPassPhrase ^
   /command ^
   "option batch off" ^
   "option confirm on" ^
   "lcd C:\Users\MyDirectory\Downloads" ^
   "get -latest *.txt" ^

Attached is a screenshot of what happens on the Command Prompt window. I've also attached the batch file as well.