How do I pass a username to an FTP command from the command line?

drewwyatt picture drewwyatt · May 29, 2014 · Viewed 25.6k times · Source

I am attempting to script a file upload using WinSCP using a batch script. The problem is, I cannot figure out how to pass the FTP username/password to the prompt. Here is my script:

@echo off
"..\..\..\Program Files (x86)\WinSCP\WinSCP.com" /command "option batch abort" "option confirm off" "open ftp://**.***.***.*" "put boom.txt /test/" "exit"
echo Domain\ftp_user
set /p dummy=press enter to close

Currently my echo command isn't working, and the command prompt still shows:

Prompting for credentials....
Username: 

How do I pass a username/password to this thing?

Answer

Dimitris Kalaitzis picture Dimitris Kalaitzis · May 29, 2014

The syntax for specifying credential in an FTP URL is:

ftp://username:password@hostname/