In my batch file I have the following code:
cd /D "C:\Putty.0.63"
psftp -b D:\batch\psftp.txt [email protected] -pw myPassword
pause
psftp.exe is in the C:\Putty.0.63 location.
In psftp.txt I have open ftp.server.com
I can log in to the ftp server but I don't know how to put a file. I tried to put cmd in the batch file or the textfile, but nothing works. Looks like I can't do put inside a batch file.
Any ideas?
Solved:
In psftp.txt I had :
open ftp.server.com
put myFile.sql
to make it work I removed the first line and just left the put myFile.sql in the file. I didn't need the open ftp.server.com because i was already opening the connection in the batch file with [email protected] -pw myPassword
You are opening a connection twice:
[email protected] -pw myPasswordopen ftp.server.com.The
opencommand fails, as you are already connected. So theputcommand never executes.