# Topic "Upload files to Remote server using WinSCP-SFTP and VBScript"

Author Message
srikanth.doddi
[View user's profile]

Joined: 2016-04-05
Posts: 1
Location: USA
HI all,

Firstly forgive me for my ignorance. I am an amateur in WinSCP automation.
I am trying to upload a file which is in my local drive to Remote server. As suggested by someone, I am using the below code in VBScript (.VBS FIle). When I execute this, I am getting an error stating ' The system cannot find the file specified'

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

sftpcmd = "winscp /console /command ""open sftp://username:passowrd#@51.16.4.XX -hostkey=""""ssh-rsa 1024 b5:45:a1:fc:ea:33:61:1c:0a:5d:73:67:b9:XX:XX:XX"""""" ""put C:/Users/doddisri/ParentFolder/Dummy.txt /opt/jass/appresources/insr/tmp/folder/"" ""close"" ""exit"""

wshShell.Run(sftpcmd),1,true

(NOTE: C:/Users/doddisri/ParentFolder/Dummy.txt is my file in local. I have to copy this file into /opt/jass/appresources/insr/tmp/folder/ which in Remote server. I have to upload this file on a daily basis)

I am not understanding why am getting the error. Is it probably because of the way am invoking winscp? I have been trying a lot, but in vain.

Any suggestions would be of great help.

Regards,
Srikanth D
martin◆
[View user's profile]
Joined: 2002-12-10
Posts: 27106
Location: Prague, Czechia
There's nothing wrong with your command.

Enable logging and attach the log here:

sftpcmd = "winscp /log=c:\path\to\winscp.log /console /command ..."

You can post new topics in this forum

## What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!