Topic "Transferring files by WinSCP in batch mode?"

Author Message
Russell
[View user's profile]

Joined: 2003-09-10
Posts: 3
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
There are several command-line SCP/SFTP clients, you may use them. I would recommend you PSCP and SFTP from Putty package.
_________________
Martin Prikryl
Russell
[View user's profile]

Joined: 2003-09-10
Posts: 3
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Please, read help to PSFTP.

PSFTP does not support ASCII mode. In fact neither SCP nor SFTP (up to version 3) do support ASCII mode. Read WinSCP's Supported transfer protocols page for more details.
_________________
Martin Prikryl
Guest




prikryl wrote:
Please, read help to PSFTP.

PSFTP does not support ASCII mode. In fact neither SCP nor SFTP (up to version 3) do support ASCII mode. Read WinSCP's Supported transfer protocols page for more details.


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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
First of all: I suppose that Putty has it ows support forum or something like that. I do not use PSFTP regulary, so I'm not a right person to be asked.

Quote:
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, asociate a key with it and reuse it with PSFTP (-load sessionname).

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

I do not use it, so I cannot help. Maybe it meant so, that you have to specify both "-b file" and "-bc/-be" parameter, not "-bc file".

Quote:
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.
_________________
Martin Prikryl
Guest




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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Anonymous wrote:
Finally, when will putty be able to handle by batch in ASCII?

How do I know? Smile
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.
_________________
Martin Prikryl
Russell
[View user's profile]

Joined: 2003-09-10
Posts: 3
prikryl wrote:
Anonymous wrote:
Finally, when will putty be able to handle by batch in ASCII?

How do I know? Smile
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.


Thanks again.

The putty website is now working again, so I'll go off and bother them. Smile
Russell
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License