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

martin

Re: SFTP connection not working when we use script option

It's not because of the script, but because you used the /ini=nul switch, which forces you to specify the host key in the open command.
See https://winscp.net/eng/docs/scripting#configuration
Dhanasekara pandian

SFTP connection not working when we use script option

Hi,

I am using WINSCP 5.13 and Windows 10.

I tried to connect SFTP in command prompt like following. "open sftp://****@**.***.**.** -privatekey="W:\Private.ppk" -passphrase=****" after getting in to WINSCP. It is working fine.

I tried the same using a script file like """C:\Program Files (x86)\WinSCP\WinSCP.exe" /ini=nul /script="W:\SendFileCommands.txt".

File has the following script "open sftp://****@**.***.**.** -privatekey="W:\Private.ppk" -passphrase=****".

When I run using script, is is failing to authenticate and expects the Hostkey.

May I know why it requires host key while we try to run the same using script?

Could you please give me the solution for this?