I'm scripting WinSCP, and need to dynamically pass in a FTP username and password, depending on which environment I'm using.

However, the docs say, "WinSCP does not support providing the passphase from command line or by other means allowing automation"

Is there another way?

link|improve this question
One thing to be aware of (if you weren't already) is that the username and password will be stored in plain text. If there's a console log (or something like doskey is running), it may be possible for someone to retrieve these passwords. – Andrew M. Dec 7 '11 at 23:10
@Redmumba, correct. The password would be exposed to a local attacker, or local malicious code with sufficient privileges. However, there are mitigating factors in our case to prevent escalation. Further, FTP passwords are already vulnerable to network interception. – Matthew Flaschen Dec 8 '11 at 0:09
feedback

2 Answers

Have you tried using something like ftp://user:pass@ftp.example.com as the address ?

You script can then build this uri depending on you environment.

This example uses sftp but ftp should be similar.

link|improve this answer
feedback

Use /parameter and %1% and %2% in the script:

WinSCP.com /console /parameter username password /script=some.script

In some.script:

open ftp://%1%:%2%@servername
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.