batch-filecmdputtywinscppscp

How to load local file to WINSCP with password?


I used codes in below link with my batch script. But it is asking for password. When I provided pw with password it is not working. First Time it is aking for yes or no when I try in command prompt. In second try it is not asking like that. So I need batch script which need to load local file to WINSCP with password. Also need to answer y.

https://www.ssh.com/ssh/putty/putty-manuals/0.68/Chapter5.html

Sample code I used in batch script:

pscp c:\documents\foo.txt fred@example.com:/tmp/foo
pw Exam454656.

Solution

  • pscp has some specific parameters. -pw is the one you are looking for.

    pscp -pw Exam454656 c:\documents\foo.txt fred@example.com:/tmp/foo