Transferring files by WinSCP in batch mode?

Advertisement

Russell
Joined:
Posts:
3

Transferring files by WinSCP in batch mode?

Is there a means of initiating a secure file transfer
by means of a .bat script?

Eg winscp.exe -b filename.txt

.txt contains open location
cd /path
ascii
get file

Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: Transferring files by WinSCP in batch mode?

There are several command-line SCP/SFTP clients, you may use them. I would recommend you PSCP and SFTP from Putty package.

Reply with quote

Russell
Joined:
Posts:
3

Re: Transferring files by WinSCP in batch mode?

I've tried this (putty) -

psftp -b xxx.txt

xxx.txt contains open id@server

Whatever I add next gets ignored and I get the password prompt. I also can't specify that I want the file to be transferred in ASII

Russell

Reply with quote

Guest

Re: Transferring files by WinSCP in batch mode?

1) Password is prompted for. Where does that go in the script?

2) Only -b works – -bc and -be don't

3) get doesn't do anything

Russell

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: Transferring files by WinSCP in batch mode?

First of all: I suppose that PuTTYt has it ows support forum or something like that. I do not use PSFTP regularly, so I'm not a right person to be asked.

1) Password is prompted for. Where does that go in the script?
IFAIK Putty does not allow password to be stored anywhere, including script. You may use RSA key authentication instead. You may use Pageant. Alternatively, define your own stored session using Putty, associate a key with it and reuse it with PSFTP (-load sessionname).

2) Only -b works – -bc and -be don't
I do not use it, so I cannot help. Maybe it's meant so, that you have to specify both -b file and -bc/-be parameter, not -bc file.

3) get doesn't do anything
Make sure that there is new-line mark after get command. PSFTP otherwise ignores last batch line (probably bug). To be sure, add some dummy command at the end of the batch.

Reply with quote

Guest

Re: Transferring files by WinSCP in batch mode?

1) I've found the right place for the password in the
call.

2) -bc goes in a different place and as a separate
command to -b

3) There has to be a carriage return after the last
batch command.

Thanks for your help. We've just upgraded to your latest WinSCP.

Finally, when will putty be able to handle by batch in ASCII?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,453
Location:
Prague, Czechia

Re: Transferring files by WinSCP in batch mode?

Anonymous wrote:

Finally, when will putty be able to handle by batch in ASCII?
How do I know? :-)
On their wishlist there is an item Line ending conversion in PSCP and PSFTP already. They evidenly do not want to implement that fake ASCII mode, which WinSCP does. So their only option to support for SFTP4 text mode feature (which WinSCP also supports). But the fact is (as they state also), there are very few servers yet, which support SFTP4. I know only VanDyke Shell.

Reply with quote

Russell
Joined:
Posts:
3

Re: Transferring files by WinSCP in batch mode?

Thanks again.

The PuTTY website is now working again, so I'll go off and bother them. :)
Russell

Reply with quote

Advertisement

You can post new topics in this forum