Post a reply

Options
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)

Options

Topic review

jay8769876

haha - Yup that worked! Thanks for your help!
jay8769876

Exit WinScp Once Script Complete

Hi,

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\
WinSCP.com /open MyConnectionName /passphrase=MyPassPhrase ^
   /command ^
   "option batch off" ^
   "option confirm on" ^
   "lcd C:\Users\MyDirectory\Downloads" ^
   "get -latest *.txt" ^
   "exit"


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