Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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