Scripting connection fails

Advertisement

PNORMAN
Joined:
Posts:
2

Scripting connection fails

I installed the product today and I'm trying to execute a script connection.

I am able to connect to SFTP using GUI but not by using script.

I created a script below and saved it to the file I:\ProjectMates\Send2PrjMates.txt

Scrip:
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open sftp://user:password@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Connect
# Specal charaters are entered as hexdecimal an "@" is entered as %40
open sftp://SourcePMDynamics:ShvacDynamics%4013@projectmates.com:222

# Change remote directory
cd /Drop
synchronize remote I:\ProjectMates\Send /Drop
# Disconnect
close
# Exit WinSCP
exit

I execute the scrip by opening a command prompt and pasting the command below:

"C:\Program Files (x86)\WinSCP\WinSCP.com" script=I:\ProjectMates\Send2PrjMates.txt


I get the error "Host does not exist"

My password for the SFTP site is ShvacDynamics@13

The port is:222

I am user WinSCP version 5.14 Build3020

on a Windows 7 Pro workstaion

The protocall is SFTP-4

I am able to syncronize using the GUI. What am I doing wrong with the command interface.

Is is also possible to refernce a UNC path for the script and the synchronize command?

Reply with quote

Advertisement

PNORMAN
Joined:
Posts:
2

Re: Scripting connection fails

martin wrote:

In GUI you use host name sftp.projectmates.com, while in script you use projectmates.com.

Thanks for the update. I tried this prior with the same results. To confirm, I changed the script again and re-ran. I get the same error, "Host does not exist"

Below is a copy of the new script I just ran.


# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open sftp://user:password@example.com -hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Connect
# Specal charaters are entered as hexdecimal an "@" is entered as %40
# open sftp://SourcePMDynamics:ShvacDynamics%4013@projectmates.com:222

open sftp://SourcePMDynamics:ShvacDynamics%4013@sftp.projectmates.com:222

# open sftp://SourcePMDynamics:ShvacDynamics%4013@[209.235.100.69]:222
# open sftp://SourcePMDynamics:ShvacDynamics%4013%40projectmates.com:222
# Change remote directory
cd /Drop
synchronize remote I:\ProjectMates\Send /Drop
# Disconnect
close
# Exit WinSCP
exit

Reply with quote

martin
Site Admin
martin avatar

Re: Scripting connection fails

Please attach a complete session log file both from the script and GUI. Alternatively compare them yourself to find the difference.

Reply with quote

Advertisement

You can post new topics in this forum