How to download files using WinSCP command line?

1

1

I have created a .txt file and saved it as abc.txt. I'm trying to use this to download files from a remote server.

The contents of the said .txt file are:

option batch abort
option confirm off
open stfp://root:password@123.456.789.2/ -hostkey="ssh-rsa AA:BB:CC:12:22"
get %1%
exit

I'm trying to run this file via command prompt. So I've opened the cmd prompt, and enter commands as follows

cd  C:\Program Files (x86)\WinSCP

winscp E:\Ritesh\abc.txt /parameter // file.csv

file.csv being the remote file I want to download. However, this is not working. I can't figure out why. Please help

Ritesh Bhakre

Posted 2017-02-02T12:15:45.377

Reputation: 133

Answers

1

You are missing the /script switch:

winscp /script=E:\Ritesh\abc.txt /parameter // file.csv

Martin Prikryl

Posted 2017-02-02T12:15:45.377

Reputation: 13 764