Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know there is a ftp command wich can be run from command line in windows and it downloads a file from ftp. User + password are specified in "that" one-line cmd. These options + password passtrough should be on that command line.

echo open 192.168.1.64 21> ftp.txt
echo anonymous>> ftp.txt
echo ftp@ftp.com>> ftp.txt
echo bin >> ftp.txt
echo get test.txt >> ftp.txt
echo bye >> ftp.txt

ftp -s:ftp.txt
share|improve this question
    
Do you need to download via FTP or do you just need to download those file with any program? (Rsync can read from a file with names to sync and from the command line. Scp can also do that from the command line. Both are not as ancient as plain-text,no_true_security FTP). –  Hennes Jan 10 '13 at 18:16
add comment

3 Answers

Try this: Batch files - Unattended FTP downloads

WGET ftp://ftp.mydomain.com/path/file.ext  

for anonymous downloads

or:

WGET ftp://user:password@ftp.mydomain.com/path/file.ext  

when authentication is required.

share|improve this answer
    
i dont see any command wich has user and password switch option in ONE line there. –  soundhax Jan 10 '13 at 18:26
    
-s switch was in sentence as i remember –  soundhax Jan 10 '13 at 18:29
1  
Welcome to Super User! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Canadian Luke Jan 10 '13 at 18:51
add comment
up vote 1 down vote accepted

I found the way:

echo open 192.168.0.1 >> ftp &echo user admin w00t >> ftp &echo binary >> ftp &echo get file.zip >> ftp &echo bye >> ftp &ftp -n -v -s:ftp &del ftp
share|improve this answer
add comment

Note that you can ask for the syntax of a command in DOS by using the /? switch. For example:

C:\>ftp /?

Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.

FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuf
fer] [-b:asyncbuffers] [-w:windowsize] [host]

  -v              Suppresses display of remote server responses.
  -n              Suppresses auto-login upon initial connection.
  -i              Turns off interactive prompting during multiple file
                  transfers.
  -d              Enables debugging.
  -g              Disables filename globbing (see GLOB command).
  -s:filename     Specifies a text file containing FTP commands; the
                  commands will automatically run after FTP starts.
  -a              Use any local interface when binding data connection.
  -A              login as anonymous.
  -x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
  -r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
  -b:async count  Overrides the default async count of 3
  -w:windowsize   Overrides the default transfer buffer size of 65535.
  host            Specifies the host name or IP address of the remote
                  host to connect to.

Notes:
  - mget and mput commands take y/n/q for yes/no/quit.
  - Use Control-C to abort commands.

In your case, you'll want to use the -s switch to feed it a script, including the login responses.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.