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: Need help with automating an upload to our SFTP site using WinSCP and a Batch File.

You have to replace the ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx... placeholder with a real fingerprint of the host key.

WinSCP GUI can generate the code for you:
https://winscp.net/eng/docs/ui_generateurl#script
sherwinj

Need help with automating an upload to our SFTP site using WinSCP and a Batch File.

I have the following script in a Text File...if I run from a DOS Commandline
winscp.com /ini=nul /script=C:\admin\Faster\FasterScript2.txt

The File has the following info...

# Connect
open sftp://user:password@server.umich.edu/ -hostkey="ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx..."
# Change remote directory
cd INBOUND
# Upload the file to current working directory
mput C:\admin\Faster\TestUpload.txt
# Disconnect
close
# Exit WinSCP
exit

I get a "If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection
press Cancel.(Y)es, (N)o, C(a)ncel, (C)opy Key:"

If I pres [Y] and [enter key] it works.

My Question is, how can I have the "If you trust...message" no longer be there?

Also, how can I get this in a Batch File, so I can schedule it as a Task??

Thank you in advance for your help!

Jody Sherwin
U of M
Email: sherwinj@umich.edu
Phone: 734-615-5644