Command to automatically input password for pscp

MOHAMED picture MOHAMED · Apr 15, 2014 · Viewed 55k times · Source

I want to copy some file to a remote Linux system from my Windows PC using pscp (from putty). I wrote a small script that call the pscp commands in this way:

"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts\* [email protected]:/root/scripts
"C:\Users\hp\Desktop\pscp.exe" -scp C:\Users\hp\Desktop\scripts2\* [email protected]:/root/scripts2 

pause

But when I launch this bat script, I'm asked to input the password, so I input the password manually.

Is there a way to input the password automatically through the batch file?

Answer

blueberry0xff picture blueberry0xff · May 24, 2016
pscp -pw yourPasswordHere C:\Users\testUser\Downloads\test.sh [email protected]:/home/testUser

I've noticed that no one posted sample of that command with -pw option.