Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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
Guest From Toronto

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.
martin

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.
Frustrated

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