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?
The SCP command; on its own, is not sufficient enough to accommodate password authentication under a one-line command usage and therefore leads to a successive password prompt for the OS user to enter the required login passcode.
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.
From putty documentation
5.2.2.6 -pw passw login with specified password
If a password is required to connect to the host, PSCP will interactively prompt you for it. However, this may not always be appropriate. If you are running PSCP as part of some automated job, it will not be possible to enter a password by hand. The -pw option to PSCP lets you specify the password to use on the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With