ftp -n -s:test.txt 含意是:你在ftp里要键入的那些指令单放在一个脚本文件里了,名为 test.txt
参数 -S: 代表后面是指定的带有自动指令的脚本命令文件。
更详细的信息可以看它的帮助,FTP --help 就可以看帮助信息了,而
FTP /?则不会出现帮助。
FTP --HELP的获得帮助信息的这种 --HELP而非 /?来源于Linux风格,那里用法也一样。
C:\windows\system32>ftp
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP
-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:buffer size 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.
既然是FTP一运行就要调用你通过 -S:参数指定的自动指令脚本文件,
那么这个 test.txt 当然要在当前目录才能找到了。
为什么test.txt 的内容是这样的:
o 127.0.0.1 21
user admin
pass
put D:\1234\*.*
exit
因为如果你直接进入FTP的话,也要先告诉它你要连接哪个服务器吧?
所以指令为:
open 你要连接的服务器地址 21
这个21为你要指定连接服务器的端口(一般都默认为21,如果不是21一般是为了防黑客扫描……等特殊原因)
然后服务连接通了,
自然要你输入登录名与密码,
所以,如果你亲自用FTP内操作一回,记住你都用过什么指令了,
就可以单写出一个这个“回答”指令自动执行的命令集,放到一个文本文件里,
然后如he200377的示例原理一样进行操作就行了。
进入FTP内,如果键入 ? 还可以获得更详细的命令帮助。
至于你的自动应答的指令文件(test.txt)内都放哪些操作指令,
这要你先手功使用ftp把你要的所用工作操作一遍,
这样你就知道系统会问你什么,然后你要输入什么内容(这个输入的就是要放到自动指令集文件内的)。
Last edited by redtek on 2006-10-31 at 10:24 AM ]
The meaning of
ftp -n -s:test.txt is: the commands you need to type in
ftp are placed in a script file, named test.txt.
The parameter -s: means that the following is the specified script command file with automatic commands.
For more detailed information, you can look at its help. You can view the help information by
FTP --help, while
FTP /? will not show the help.
The acquisition of help information by
FTP --HELP, this --HELP instead of /? comes from the Linux style, and the usage is the same there.
C:\windows\system32>ftp
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP
-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:buffer size 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.
Since
FTP will call the automatic command script file specified by you through the -s: parameter as soon as it runs,
then this test.txt must be in the current directory.
Why the content of test.txt is like this:
o 127.0.0.1 21
user admin
pass
put D:\1234\*.*
exit
Because if you directly enter
FTP, you also need to tell it which server you want to connect to first?
So the command is:
open the server address you want to connect to 21
This 21 is the port number of the server you want to specify for connection (it is generally 21 by default, if it is not 21, it is generally for special reasons such as preventing hacker scanning...).
Then the service is connected,
naturally you need to enter the login name and password,
so, if you operate in
FTP yourself, remember what commands you have used,
you can write a command set for this "answer" command to execute automatically, put it in a text file,
and then operate as in the example principle of he200377.
Enter
FTP, if you type?, you can also get more detailed command help.
As for which operation commands are placed in your automatic response instruction file (test.txt),
you need to first use
ftp to perform all the work operations you need,
so you will know what the system will ask you, and then what content you need to enter (this input is what should be put into the automatic instruction set file).
Last edited by redtek on 2006-10-31 at 10:24 AM ]