including password in script - error 'host not found'

Advertisement

ac2010
Guest

including password in script - error 'host not found'

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.

Reply with quote

Advertisement

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

Reply with quote

ac2010
Guest

including password in script - error 'host not found'

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

Reply with quote

ac2010
Guest

including password in script - error 'host not found'

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.

martin wrote:

Try removing the /log switch.
:D

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum