Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

For Example : ftp://hello.mydomain.com 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 hello.mydomain.com

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 hello.mydomain.com --username me --password onlyme

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

share|improve this question

migrated from stackoverflow.com Feb 15 '11 at 13:23

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

add comment

3 Answers

Anyway, this guy shows exactly how to do it:

ftp -s:script.txt ftp.server.com

and the contents of script.txt could be:

your_username
your_password
bin
cd /files
put file.zip
bye

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
add comment

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:

http://www.nsftools.com/tips/MSFTP.htm

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

http://www.howtogeek.com/howto/windows/how-to-automate-ftp-uploads-from-the-windows-command-line/

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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