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

NoUsername

Host invalidcharacter does not exist

Hello. I encountered this problem (with powershell) and this thread. In my case, the problem was an invalid character.

Error: Exception calling "Open" with "1" argument(s): "Host "<FQDN>" does not exist."

The hostname property is set with this regexp:
$sftpLine -match '(^sftp -o Port=)(?<port>[0-9]+) (?<username>.*)\@(?<hostname>.*)$'
$sftpHostname=$matches.hostname

Problem: the regexp output includes the carriage return character (in powershell: "`r").
$sftpHostname.Replace("`r",'') -eq $sftpHostname
False

Note that the powershell error does not show the carriage return character anywhere. I found it by looking at the session output. $session.Output:
...

winscp> open "sftp://username:***@hostname%0D:2222" -hostkey="ssh-rsa 2048 xx:xx:xx.." -timeout=15
...

Look at the hostname, it ends with "%0D". That is not good...
The fix? Replace the invalid character with nothing:
$sftpHostname=$matches.hostname.Replace("`r",'')
martin

millerintllc wrote:

10 years later and I have the same exact problem...

And I have same exact answer:
Please start a new thread for your new problem and include a complete session log file.
millerintllc

10 years later and I have the same exact problem...
martin

Re: Hst C does not exist

ravi3300 wrote:

hi..
when i trying to open any file from ftp site then got error Host "C" does not exist.
winscp error pls help

Please start a new thread for your new problem and include a complete session log file.
ravi3300

Hst C does not exist

hi..
when i trying to open any file from ftp site then got error Host "C" does not exist.
winscp error pls help
martin

Re: "Host does not exist"

Jimmy S wrote:

I could fix it, I don't know if it is going to work in your case, adding the path of the winscp into the script. For example:

This is what I had with "Host does not exist"
winscp.com GyT /script=gyt.txt

then I changed it to this and it worked(basically I pointed out the path of winscp command and the script):
c:\progra~2\winscp\winscp.com GyT /script=c:\ftptrans\gyt.txt

1) You should not open site for scripting using command-line parameter. Use open command from the script instead.
2) Path to a script file cannot make a difference for this.
3) Path to a winscp.com makes a difference, when you are using an INI file stored in c:\progra~2\winscp and your PATH actually points to a different instance of winscp.com (with different configuration) that does not know the "GyT" site.

The best to do is to avoid depending on a configuration:
https://winscp.net/eng/docs/scripting#configuration
Jimmy S

Re: "Host does not exist"

rickyj wrote:

I receive the "Host does not exist" message when trying to use the /script=filename option. However, when I use manually enter the same information that is in the file using winscp interactively, I can login to the server without any problems. Why??????


I could fix it, I don't know if it is going to work in your case, adding the path of the winscp into the script. For example:

This is what I had with "Host does not exist"
winscp.com GyT /script=gyt.txt

then I changed it to this and it worked(basically I pointed out the path of winscp command and the script):
c:\progra~2\winscp\winscp.com GyT /script=c:\ftptrans\gyt.txt

Cheers!
BryWalt

Admin please!

martin wrote:

caio wrote:

Well, i've just installed winscp on my machine and wants to copy files to a remote backup folder...
when i run winscp.com and then use the command open ftp://user:pass@IP:port, it connects fine...but if i run one script with the command "open ftp://user:pass@IP:port" inside (without the quotes), it keeps saying Host does not exist...is there any way to debug this error, so i can find why it keeps happening?i think it's some problem on parsing the string in the script file, but can't be sure, it's just a guess...
well, any help would be appreciated...thanks in advance

Just enable logging to see how WinSCP parsed the URL.


Prikryl, I wish you could offer more help! For example, your answer above could go much further if you explained how to ENABLE LOGGING! Geez!
dmartin

WINSCP CONNECTION TO IPHONE 4

Hi Can someone please help me I am just about had enough with Winscp and trying to connect my iphone. I have gone through all of the forums and try everything and have no luck?

My Specs are as follows;
1. Windows 7
2. Iphone 4 - IOS 4.3.3 Jailbroken with Cydia installed
3. Openssh installed and working fine
4. SBsettings - ssh toggle turned on
5. when I try to connect to my iphone I get "network error - connection refused"

Trust I have tried everything as per lot of those forum installing Ipohne tunnel programs and still have no luck. I would really really appreciate any help from someone.

Thanks you.
caio

Hey, it worked now, thanks...
martin

Re: Host does not exist

caio wrote:

Well, i've just installed winscp on my machine and wants to copy files to a remote backup folder...
when i run winscp.com and then use the command open ftp://user:pass@IP:port, it connects fine...but if i run one script with the command "open ftp://user:pass@IP:port" inside (without the quotes), it keeps saying Host does not exist...is there any way to debug this error, so i can find why it keeps happening?i think it's some problem on parsing the string in the script file, but can't be sure, it's just a guess...
well, any help would be appreciated...thanks in advance

Just enable logging to see how WinSCP parsed the URL.
caio

Host does not exist

Well, i've just installed winscp on my machine and wants to copy files to a remote backup folder...
when i run winscp.com and then use the command open ftp://user:pass@IP:port, it connects fine...but if i run one script with the command "open ftp://user:pass@IP:port" inside (without the quotes), it keeps saying Host does not exist...is there any way to debug this error, so i can find why it keeps happening?i think it's some problem on parsing the string in the script file, but can't be sure, it's just a guess...
well, any help would be appreciated...thanks in advance
Guest

I found an error - it was inside my batch, the call to *.cmd should be:

winscp "/script=%FTPSCRIPT%"

This is because Windows "eats" '=' character inside parameters, if not enclosed by quotation marks.
martin

Anonymous wrote:

FTPSCRIPT doesn't have spaces or special characters, it is equal to:

C:\Users\myuser\AppData\Local\Temp\myscr.ftp

where "myuser" is current user's profile name and "myscr.ftp" is script file name.

Can you send me an email, so I can send you back a debug version of WinSCP to track the problem? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.
Guest

FTPSCRIPT doesn't have spaces or special characters, it is equal to:

C:\Users\myuser\AppData\Local\Temp\myscr.ftp

where "myuser" is current user's profile name and "myscr.ftp" is script file name.
martin

guest2011 wrote:

and in the main batch:
winscp /script="%FTPSCRIPT%"

When you change the main batch to:
d:\myapps\WinSCP\WinSCP.com /script="%FTPSCRIPT%"

What is value of FTPSCRIPT?
guest2011

This problem exists when you use batch script to execute COM program, like this:

(winscp.cmd)
d:\myapps\WinSCP\WinSCP.com %1 %2 %3 %4 %5 %6 %7 %8 %9

and in the main batch:
winscp /script="%FTPSCRIPT%"

When you change the main batch to:
d:\myapps\WinSCP\WinSCP.com /script="%FTPSCRIPT%"

everything works OK

Looks like COM program reads command line arguments in non-standard way.
Caipre

I was having this exact issue -- entering the hostname, login, and password from the CLI worked fine, but running a batch script of the same information failed with the "Host does not exist" message. The log indicated that the program had confused the /script="..." parameter as the hostname.

I noticed the version of WinSCP was out of date, so I updated.
Works as expected now.
collinj

Re: Sucks

Sorry for the typo. I want to re-type this to make it clear.
prikryl, I don't know why you even bother to reply to these posts. You obviously don't have a clue!
collinj

Sucks

prikryl, you don't why you even bother to look at post. From your input it is clear you do not have an idea what the problems are!
anoni

administrator sucks

you suck.. you did not answer their question. And the problem is true.
Guest

Re: "Host does not exist"

entering the command:
winscp /console script.tmp

instead of
winscp /console /script=script.tmp

will result in 'Host not found', I think new users sometimes just don't see the '/script=' part I know I didn't.
martin

Anonymous wrote:

It uploads the file but failing with error "Assertion failied:random_active>=0". you mentioned that you fixed the bug in latest release. I installed latest version. I have the host key in INI file and ran command to read from INI file rather than registry.here is the command argument.

Thanks for your post. This bug is being tracked already.
Guest

I read that. I solved this problem by replacing script argument with command argument but now I am getting different problem.It uploads the file but failing with error "Assertion failied:random_active>=0". you mentioned that you fixed the bug in latest release. I installed latest version. I have the host key in INI file and ran command to read from INI file rather than registry.here is the command argument.

script= /command "option batch on" "open username:password@ftp.ftp.com" "optin transfer binary" "put xxx_DEV.csv" "close" "exit". If i run from command prompt I am not getting error. if i run it on ssis package I am getting this error. can you help me on this?
martin

Re: getting the same error from ssis

sridhar wrote:

I am able to manually run my batch file to upload file but it fails when I use ssis process task. can you tell me what might be the cause?

Please read FAQ. If that does not help, come back.
sridhar

getting the same error from ssis

I am able to manually run my batch file to upload file but it fails when I use ssis process task. can you tell me what might be the cause?
Priyaranjan

Sorry about the typo in -hostkey=

Sorry about the typo in the last post.
My commands are like following.
I use a bat file to initiate the commands

bat file code
@echo off
winscp.com /script="C:\runthis.txt"

runthis.txt code
option batch on
option confirm off
open sftp://user:password@host:port -hostkey="ssh-blah blah"
synchronize remote -criteria='both' "C:\Backuptest" "/www/cgi-bin/test"
chmod 644 /www/cgi-bin/test/*.html
chmod 775 /www/cgi-bin/test/*.py
synchronize remote -criteria='both' "C:\Backup" "/www/cgi-bin"
chmod 644 /www/cgi-bin/*.html
chmod 775 /www/cgi-bin/*.py
synchronize remote -criteria='both' "C:\js" "/www/htdocs/test/js/"
exit

winscp.exe did not work for me from the webpage. winscp.com worked fine. Don't know why.
Priyaranjan

Solution I found for this problem

I am running python to initiate winscp to synchronize my folder with a central server. I had the same problem. When I run the python with a web page winscp returns error host doesn't exist. But, when I run the code directly, it was working. So, after going through a lot of documentation, I thought of trying sftp://username:password@hostaddress and when tried this, it failed and the reason is it returned a hostkey to accept in the stdout. That means this session of winscp is running like a fresh connection to that host eventhough I have connected to that host before. So, I copied the host key in stdout used with -hostkey=="My Key" option at the end of open command and it worked. Now I am able to run a python code behind a webpage to synchronize my files. If at all this makes any sense to you, try it yourselves leave a feedback.
martin

Re: same error

Jimboberlin wrote:

Hi - according to your tracker this bug has been resolved

I do not see any relation to the referenced bug.

When entering the same commands in the shell everything works like a charm!
Any Ideas?

Please post a full log file showing the problem. Both log file from the shell and script.
Jimboberlin

same error

Hi - according to your tracker this bug has been resolved - I get the same error with this simple script:

Code
# Connect 
open root@87.230.6.132
# Change remote directory
cd /srw/www/bulk_files/rails/down/app/
# Force binary mode transfer
option transfer binary
# update folder
keepuptodate d:\prog\php_projects\down\app\ /srw/www/bulk_files/rails/down/app/
# Disconnect
close
# Exit WinSCP
exit


Output:
Searching for host...

Host does not exist


When entering the same commands in the shell everything works like a charm!
Any Ideas?
martin

Re: some more info

Delphi wrote:

In my case I had used batch files to start several sessions at once. This was no problem as long as I left them directly in the base folder.
...

Thanks for your post. This issue has been added to tracker.
Delphi

some more info

In my case I had used batch files to start several sessions at once. This was no problem as long as I left them directly in the base folder.
c:
cd \Programme\WinSCP3
START WinSCP.exe "connection25"
PING -n 2 127.0.0.1>nul               # poor man's delay
START WinSCP.exe "connection32"
Meanwhile this list had grown much too long so I moved many of the connections into project specific folders. I changed my batch accordingly
c:
cd \Programme\WinSCP3
START WinSCP.exe "folder/connection1"
PING -n 2 127.0.0.1>nul               # poor man's delay
START WinSCP.exe "folder/connection2"
Well and now it says "Host does not exist" - but if I open them manually they work perfectly. Any idea what I am doing wrong?
martin

Grandilo wrote:

Hello i have the same problem, when i lauch the script in console mod, i have "host does not exist" but if i write open in winscp console and my @ip of my server, it works

So do you use IP address in both cases or hostname in the first?
Grandilo

Hello i have the same problem, when i lauch the script in console mod, i have "host does not exist" but if i write open in winscp console and my @ip of my server, it works

my script :
option batch on
option confirm off
open root@172.20.20.2
option transfer binary
get /root/test
close
exit

in exemple, its user@exemple.com, if its only user@ip there is a pb?
martin

Re: "Host does not exist"

That doesn't make any sense.
1) Do you use the same binary (exe) for GUI and the script? And from the same directory? From the same host?
2) Please post the script.
3) Post a log file of success in GUI and failure with script.
rickyj

"Host does not exist"

I receive the "Host does not exist" message when trying to use the /script=filename option. However, when I use manually enter the same information that is in the file using winscp interactively, I can login to the server without any problems. Why??????