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

martin

Re: I've found one way to fix it

geri777 wrote:

Seems not to work if the password contains a forward-slash. Example: ftp://myuser:abcdefg/123@mydomain.com/

You have to URL-encode it:
https://winscp.net/eng/docs/session_url
geri777

Re: I've found one way to fix it

Seems not to work if the password contains a forward-slash. Example: ftp://myuser:abcdefg/123@mydomain.com/
PovilasPanavas

Re: How to correctly connect to ftp using password and username

martin wrote:


Should be:
open ftp://username:password@hostname


oh! :) Thank you.
martin

Re: I've found one way to fix it

PovilasPanavas wrote:

I created session throughout graphical interface. And using it in script. It works fine! :roll: :wink:

Where would I find session files? I want to use it directly with /ini=mysession.ini

Make sure you configure WinSCP to store its settings to INI file.
martin

Re: How to correctly connect to ftp using password and username

PovilasPanavas wrote:

It shows: "Searching for host... Network error: Connection timed out."

If i change "open ftp://aaaa.bbbb.lt" then it works, but prompts for username and password.

Also, if i try "open aaaa.bbbb.lt" shows "Searching for host... Network error: Connection timed out." (the same error as above)

Should be:
open ftp://username:password@hostname
PovilasPanavas

I've found one way to fix it

I created session throughout graphical interface. And using it in script. It works fine! :roll: :wink:

Where would I find session files? I want to use it directly with /ini=mysession.ini
PovilasPanavas

I have tried storing session

After searching for solution, I've tried creating session.ini file and storing password and username.

[Sessions\mysession]
HostName=aaaa.bbbbb.lt also tried ftp://aaaa.bbbbb.lt
UserName=myuser
PassWord=mypassword


And executing it
C:\Program Files\WinSCP>WinSCP.com /script=upload.script /ini=session.ini

Now, the error've changed: "Searching for host... Host does not exist."
PovilasPanavas

How to correctly connect to ftp using password and username

I can't figure out it on my own. I'm using example from FAQ. The problematic line is marked.


# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# PROBLEM IS BELOW
open username:password@aaaa.bbbbb.lt
# Change remote directory
cd dainava
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
put Groups.txt
# Disconnect
close


It shows: "Searching for host... Network error: Connection timed out."

If i change "open ftp://aaaa.bbbb.lt" then it works, but prompts for username and password.

Also, if i try "open aaaa.bbbb.lt" shows "Searching for host... Network error: Connection timed out." (the same error as above)

How to fix script? :)