Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am following the example at to automate the transfer of files from my PC to a sftp server however each time I include a password it fails to authenticate.

I am able to use the same password when using the WinSCP graphical user interface and when I explicitly type the password in the command line however not when I automate.

My code looks as follows

open s

I have followed the suggestion at to encode special characters hence the %21 which symbolizes an exclamation mark. Interestingly enough the example on the page does not encode the exclamation mark e.g. 4pRte!

I have also tried using password! and that doesn't work either.

share|improve this question
up vote 1 down vote accepted

The issue was that it was expecting a password phrase for a private key which WinSCP doesn't support providing programmatically as per the FAQ at

The way around it was to use the Pageant agent that is provided with the WinSCP installation or as a standalone executable at Hopefully this helps someone else in the future.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .