Topic "command line using private key"

Author Message
Frustrated

Guest


FYI - this works fine using the gui interface. fails when I try and run it in batch mode.

Here is my command:
c:\pce\winscp.com scp://macsql2@www.pcesystems.com /privatekey=private.ppk

Here is the results:
C:\PCE>c:\pce\winscp.com scp://macsql2@www.pcesystems.com /privatekey=private.pp
k /script=c:\pce\script.txt
Automatic actions are disabled when URL address is provided on command-line.
Searching for host...
Connecting to host...
Authenticating...
Using username "macsql2".
Authenticating with public key "rsa-key-20100127".
Authenticated.
Starting the session...
Connection has been unexpectedly closed. Server sent command exit status 1.
Error skipping startup message. Your shell is probably incompatible with the app
lication (BASH is recommended).

last thing, how do I have it automatically get my file once it's connected?

script.txt example:
get datamactest.zip

thanks
quit
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
First, use "open session", do not specify the session on command-line for scripting.

Then, post a log files both for GUI and script.
_________________
Martin Prikryl
Guest From Toronto

Guest


Hi,

I am trying to execute following script from SQL Server Job to upload file.

declare @ftpcmd varchar(2000)
select @ftpcmd = 'D:\WORK\FTP-SYNC\FTPClient\winscp556\WinSCP.com ftp://username:pwd@files.demosite.com /timeout=60 /console /command "option confirm off " "put D:\Work\Calendar\calendar.pdf /_sitecalendar/" "exit" /log=D:\WORK\FTP-SYNC\LOG_Calendar.txt /y '

It fails to upload file with output result as

Automatic actions are disabled when URL address is provided on command-line.
Opening session using command-line parameter in scripting is deprecated. Use 'open' command instead.
Connecting to files.demosite.com ...
Connected with files.demosite.com. Waiting for welcome message...
Connected
Starting the session...
Reading remote directory...
Session started.
Active session: [1] username@files.demosite.com
winscp>
NULL

Any help will be appreciated.
Thanks.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
The same problem as above.

You even get a hint:
Quote:
Automatic actions are disabled when URL address is provided on command-line.


The syntax you are using is wrong.

- Use open command, do not specify the session URL as command-line parameter for scripting (the primary problem)
- The /console has no effect when using winscp.com
- There's no /y switch.
- You probably want to use option batch abort.

So it should be:

D:\WORK\FTP-SYNC\FTPClient\winscp556\WinSCP.com /command "option batch abort" "option confirm off" "open ftp://username:pwd@files.demosite.com -timeout=60" "put D:\Work\Calendar\calendar.pdf /_sitecalendar/" "exit" /log=D:\WORK\FTP-SYNC\LOG_Calendar.txt
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