Topic "including password in script - error 'host not found'"

Author Message
ac2010

Guest


My ultimate goal is to use WinSCP to read usernames and passwords from a csv file and upload a test file to each account. I am trying to establish just connecting from the command line. This is my sanitized command. My password does not have any special characters in it.

"C:\Program Files\WinSCP\winscp.exe" /console /command /log "option batch on" "option confirm off" "open username:password@sftp.domain.com" "put c:\Scripts\sftptest\testfile.txt" "exit"

When I run this command I get "Searching for host. Host does not exist". How can I pass the username and password on one line? I was hoping to put this command in a script and replace the username and password with variables.
Advertisements
Yosi

Guest


you are doing it the right way.
Try to ping your sft host what do you get?
from command prompt ping sft.domain.com
Are you sure you typed the correct sftp site? are you sure it is .com and not something else
ac2010

Guest


Sorry, I should have stated that I am able to ping\connect to that host manually.

Also, if I use the same command (open username:password@sftp.domain.com) by calling a script file ("C:\Program Files\WinSCP\winscp.exe" /console /script=C:\Scripts\sftptest\winscp.txt), it works. Just not when I try to connect with the command on one line.

Yosi wrote:
you are doing it the right way.
Try to ping your sft host what do you get?
from command prompt ping sft.domain.com
Are you sure you typed the correct sftp site? are you sure it is .com and not something else
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
Try removing the /log switch.
_________________
Martin Prikryl
ac2010

Guest


Thank you, it works like a charm! Now if I can just get it to work with variables in place of the username and password, I'll be all set.

prikryl wrote:
Try removing the /log switch.
Very Happy
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
See documentation:
https://winscp.net/eng/docs/scripting#syntax
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

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!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License