Need help writing a batch script for Connecting via Pageant
I'm trying to connect to an external vendor's server via batch script. The vendor requested that we connect/authenticate using public keys. I created a public key using pageant and sent that to the vendor. I then can open WinSCP, click on tools, run pageant. I right-click on the icon from the toolbar, and add the key, then enter the phrase. From there I can enter the host name and user (no password). Once I connect, I can drag and drop the file.
At this point, I'd like to code this using a batch script. We current use batch scripting to connect elsewhere with vendor authenticating using host keys. This would be the first time using private/public keys. I created a bat file with the following command:
"C:\Program Files (x86)\WinSCP\WinSCP.com" /script=c:\script.txt
At this point, I'm confused about what to put into my script.txt. Normally for a host key connection, I would enter:
open sftp://user:password@url -hostkey="XXXXXXXX"
Reading through the documentation, I initially tried starting pageant, loading my keys, then having starting WINSCP using this:
"C:\Program Files (x86)\WinSCP\PuTTY\pageant.exe" c:\publickey.ppk -c "C:\Program Files (x86)\WinSCP\winscp.com" /script=c:\script.txt
But I'm not sure how to incorporate the phrase into the script. Would you be able to assist? Just wondering if I'm going in the right direction.
Thanks.
CD