Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

mrdobalina

Re: Command line use of HostKey

Upgrading from 4.2.4 to 4.2.5 did the trick. Thank you for the quick responses.
martin

Re: Command line use of HostKey

Your syntax works for me. Though it does not work with releases prior to 4.2.4 with the same error message you are getting. Are you sure you have 4.2.4? Both .com and .exe? Try to reinstall (and of course upgrade to stable 4.2.5).
Guest

Re: Command line use of HostKey

Thank you for your quick responses. That fixes the issue when I use a script file. Unfortunately, my data will be variable so I must run this from command line instead of dropping script files. Is the syntax slightly different in command? I tried several combinations of quotes, dashes, and slashes.

The script that works successfully:
open sftp://testuid:password@server:22 -hostkey="ssh-rsa 1024 00:00:00:00:00:00:00..."
option batch on
option confirm off
put c:\temp\source\testfile.txt
close
exit

This is the command line that errors:
C:\Program Files (x86)\WinSCP>winscp.com /command "open ftp://testuid:password@server:22 -hostkey=""ssh-rsa 1024 00:00:00:...""" "option batch on" "option confirm off" "put ""c:\temp\source\testfile.txt""" "close" "exit"

Result of this command is:
Too many parameters for command 'open'.
martin

Re: Command line use of HostKey

OK, now I have noticed the problem. You miss equal sign between -hostkey and the value:
-hostkey="ssh-rsa 1024 00:00:00:00:00:00:00...."
mrdobalina

Re: Command line use of HostKey

I changed over to a script file with the same results.

My script file contains:
open sftp://testuid:password@server:22 -hostkey "ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00"
option batch on
option confirm off
put c:\temp\source\testfile.txt
close
exit

Results:
Too many parameters for command 'open'.
batch on
confirm off
No Session.
No Session.

Works like a charm without the hostkey switch.

One critical piece of information I missed due to sleep deprivation. I've moved development over to a 64 bit server so my environment is:
Windows Server 2003 R2
Standard x64 Edition
Service Pack 2
martin

Re: Command line use of HostKey

I do not see anything wrong about your syntax. But I'm not sure if SSIS does parse/interpret the command line on its own somehow. Try to store your script into file instead. Let us know.
mrdobalina

Command line use of HostKey

I am using WinSCP in an SSIS execute process task. The input into the executable is variable so I must execute command line. The process will be run from a system account so I need to pass the hostkey. When I run the script without the hostkey specified, under my account which has accepted the hostkey, it executes successfully. Could you please provide some guidance for my syntax?

Here is the command line:
winscp.exe /command  "open ""sftp://uid:password@server:22"" -hostkey ""ssh-rsa 1024 00:00:00:00:00:00:00:00:00:00:aa:bb:cc:dd:ee:ff""" "option batch on"  "option confirm off"  "put ""c:\temp\source\testfile.txt"""  "close"  "exit"

After running the script I get following in console:
Too many parameters for command "open".

batch on
confirm off
no session
no session

Using WinSCP 4.2.4 (Build 610) on Windows XP.