ftp -n -s:test.txt 含意是:你在ftp里要键入的那些指令单放在一个脚本文件里了,名为 test.txt
参数 -S: 代表后面是指定的带有自动指令的脚本命令文件。
更详细的信息可以看它的帮助,FTP --help 就可以看帮助信息了,而 FTP /?则不会出现帮助。
FTP --HELP的获得帮助信息的这种 --HELP而非 /?来源于Linux风格,那里用法也一样。
C:\windows\system32>ftp --help
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 ]
Redtek,一个永远在网上流浪的人……
_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._