I've written two batch files - one to launch Pageant and load my keys, and the other to ssh some files onto a remote server. Individually, the scripts work perfectly. I am trying to combine them into a single batch file, but I can't get it to work.
Here are the scripts - only a line each, really.
To launch Pageant and load keys:
start E:\PuTTY\pageant.exe E:\Keys\priv.ppk
exit
To use pscp:
pscp F:\website\foobar\src\* [email protected]:/var/www/html
The problem is that the first script launches a password prompt. If I finish this and then launch the next script, everything works perfectly. But I've been unable to combine these two into one script in a way where the second command runs after the prompt from the first one is complete. How would I create a batch file that did so?
You can hardly solve this in a batch file. Pageant is GUI application. It can hardly somehow signal back to a batch file that it finished loading keys.
For this reason, Pageant has
-c
switch, which makes it run a specified program/batch-file after the keys are loaded:So this should to what you want: