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

FrankT

OK, I have one last problem with this script; In the console, I am getting the following msg.

"The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is......If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache?
(Y)es, (N)o, C(a)ncel, (C)opy Key:
"

I need it to pass on the key automatically. Any insite on how to do this with the example you provided?

Thanks!!!
FrankT

Re: using vbs to connect sftp and use "put" command

martin wrote:

You have quotes all wrong. I do not know VBS, but I guess right format is:
sftpcmd = "winscp /console /command ""open sftp://nstcn61:password@10.10.1.100 -hostkey=""""ssh-rsa 1024 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"""""" ""put c:\sysaudit\*.*"" ""close"" ""exit"""

Read also:
https://winscp.net/eng/docs/commandline#syntax

Of course the XX:XX:XX... has to be replaces with actual fingerprint.




WOW!!! I love you, man!!! You just fixed a problem for me that has been a thorn in my side for days!!! Thank you, thank you, thank you!!!
martin

Re: using vbs to connect sftp and use "put" command

You have quotes all wrong. I do not know VBS, but I guess right format is:
sftpcmd = "winscp /console /command ""open sftp://nstcn61:password@10.10.1.100 -hostkey=""""ssh-rsa 1024 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX"""""" ""put c:\sysaudit\*.*"" ""close"" ""exit"""

Read also:
https://winscp.net/eng/docs/commandline#syntax

Of course the XX:XX:XX... has to be replaces with actual fingerprint.
FrankT

using vbs to connect sftp and use "put" command

Hi! I am new to to scripting and WinSCP. I need to create a script to connect to a ftp service and copy files to it. I've tied the following with no success. Please help!!!

Dim wshShell
Dim sftpcmd
Set wshShell = WScript.CreateObject("WScript.Shell")


sftpcmd = "winscp /console /command " & """open sftp://nstcn61:password@10.10.1.100 -hostkey= ssh-rsa 1024 XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX" & "put c:\sysaudit\*.*" & "close""" & " " & """exit"

wshShell.Run(sftpcmd),1,true

wscript.sleep(20000) 'wait for 20 seconds until sftp is done




Any help would be appreciated.