command line using private key

Advertisement

Frustrated
Guest

command line using private key

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

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: command line using private key

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

Reply with quote

Guest From Toronto
Guest

Trying to run command line script from SQL Server job

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: Trying to run command line script from SQL Server job

The same problem as above.

You even get a hint:
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

Reply with quote

Advertisement

You can post new topics in this forum