Posts

Showing posts with the label Sftp

Batch File For PuTTY/PSFTP File Transfer Automation

Answer : You need to store the psftp script (lines from open to bye ) into a separate file and pass that to psftp using -b switch: cd "C:\Program Files (x86)\PuTTY" psftp -b "C:\path\to\script\script.txt" Reference: https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter6.html#psftp-option-b EDIT: For username+password: As you cannot use psftp commands in a batch file, for the same reason, you cannot specify the username and the password as psftp commands. These are inputs to the open command. While you can specify the username with the open command ( open <user>@<IP> ), you cannot specify the password this way. This can be done on a psftp command line only. Then it's probably cleaner to do all on the command-line: cd "C:\Program Files (x86)\PuTTY" psftp -b script.txt <user>@<IP> -pw <PW> And remove the open , <user> and <PW> lines from your script.txt . Reference: https://the.earth.li...