Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I connect to my ftpserver from command line in just one command line.

For Example : is my ftp server URL. I usually open a command prompt

Start -> Run -> cmd

and type ftp, which gives me the ftp prompt.

ftp> open

It asks me the user id and password

username: me  
password: onlyme

And then I connect. However, I am trying to connect automatically without having the user id and password prompt?

something like

ftp>open --username me --password onlyme

And it connects automatically without prompting the user ID and Password.

share|improve this question

migrated from Feb 15 '11 at 13:23

This question came from our site for professional and enthusiast programmers.

Anyway, this guy shows exactly how to do it:

ftp -s:script.txt

and the contents of script.txt could be:

cd /files

where the first 2 lines of the file specify the username and password used for authentication.

share|improve this answer
I still think this should be moved to Serverfault. – karlphillip Dec 21 '10 at 12:47

As far as I can see, you can't do exaclty what you're asking. You can, however specify a list of commands in a seperate text file using the -s:filename argument.

Here's a list of command line arguments for the ftp utility:

Take a look at this article which describes how to automate tasks using the ftp util:

share|improve this answer

Alternatively you could use a different FTP program. Filezilla Client works well for quick connects or you can save sessions with the username and password.

I believe there is also a command line interface if you didn't want to use the GUI.

share|improve this answer

This is an old post however, one alternative is to use the command options:

ftp -n -s:ftpcmd.txt

the -n will suppress the initial login and then the file contents would be: (replace the with your FTP site url)

user myFTPuser myftppassword
other commands here...

This avoids the user/password on separate lines

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.