FTP自动登录脚本文件 |
-s:script file路径 注意:冒号后不能跟空格,路径含空格时,需用双引号括起来. |
C:\Users\Administrator>type ins.sf
C:\Users\Administrator>ftp -s:ins.sf ftp> |
C:\Users\Administrator>type D:\.1\ins.sf
C:\Users\Administrator>ftp -s:D:\.1\ins.sf ftp> |
C:\Users\Administrator>type "D:\.1\ins 2.sf"
C:\Users\Administrator>ftp -s:"D:\.1\ins 2.sf" ftp> |
C:\Users\Administrator>dir /b ins.sf File Not Found
C:\Users\Administrator>ftp -s:ins.sf Error opening script file ins.sf.
Transfers files to and from a computer runni… |
C:\Users\Administrator>type ins.sf
C:\Users\Administrator>ftp -s: ins.sf
Transfers files to and from a computer runnin… |
C:\Users\Administrator>type D:\.1\ins.sf
C:\Users\Administrator>ftp -s: D:\.1\ins.sf
Transfers files to and from a computer runnin… |
C:\Users\Administrator>type "D:\.1\ins 2.sf"
C:\Users\Administrator>ftp -s: "D:\.1\ins 2.sf"
Transfers files to and from a computer running an… |
C:\Users\Administrator>type ins.sf open localhost wangxd 123456 pwd C:\Users\Administrator>ftp -s:ins.sf ftp> open localhost Connected to RMS365. 220 Service ready for new user. User (RMS365:(none)): 331 User name okay, need password for wangxd.
230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
说明:实际上该文件书写的就是我们平时使用ftp命令操作时的每行命令。 |
C:\Users\Administrator>type ins.sf open localhost laiye
pwd C:\Users\Administrator>ftp -s:ins.sf ftp> open localhost Connected to RMS365. 220 Service ready for new user. User (RMS365:(none)): 331 User name okay, need password for laiye.
230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
注意:密码为空时,用空行代替。 |
C:\Users\Administrator>type ins.sf open localhost laiye
pwd pwd
pwd C:\Users\Administrator>ftp -s:ins.sf ftp> open localhost Connected to RMS365. 220 Service ready for new user. User (RMS365:(none)): 331 User name okay, need password for laiye.
230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> pwd 257 "/" is current directory. ftp> ftp> pwd 257 "/" is current directory. ftp> |
注意:每个回车都会被解析。 |
C:\Users\Administrator>ftp localhost Connected to RMS365. 220 Service ready for new user. User (RMS365:(none)): |
C:\Users\Administrator>ftp localhost Connected to RMS365. 220 Service ready for new user. User (RMS365:(none)): wangxd 331 User name okay, need password for wangxd. Password: 230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
C:\Users\Administrator>ftp -n localhost Connected to RMS365. 220 Service ready for new user. ftp> |
C:\Users\Administrator>ftp -n localhost Connected to RMS365. 220 Service ready for new user. ftp> user wangxd 123456 331 User name okay, need password for wangxd. 230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
C:\Users\Administrator>ftp -n localhost Connected to RMS365. 220 Service ready for new user. ftp> user laiye 331 User name okay, need password for laiye. Password: 230 User logged in, proceed. ftp> |
C:\Users\Administrator>ftp -n localhost Connected to RMS365. 220 Service ready for new user. ftp> user laiye " " 331 User name okay, need password for laiye. 230 User logged in, proceed. ftp> |
C:\Users\Administrator>ftp -n localhost Connected to RMS365. 220 Service ready for new user. ftp> user laiye "" 331 User name okay, need password for laiye. Password: 230 User logged in, proceed. ftp> |
C:\Users\Administrator>type ins.sf open localhost user wangxd 123456 pwd C:\Users\Administrator>ftp -n -s:ins.sf ftp> open localhost Connected to RMS365. 220 Service ready for new user. ftp> user wangxd 123456 331 User name okay, need password for wangxd. 230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
C:\Users\Administrator>type ins.sf open localhost user laiye
pwd C:\Users\Administrator>ftp -n -s:ins.sf ftp> open localhost Connected to RMS365. 220 Service ready for new user. ftp> user laiye 331 User name okay, need password for laiye.
230 User logged in, proceed. ftp> pwd 257 "/" is current directory. ftp> |
注意:使用-n可以在初始连接时禁止自动登录。此时登录方式为:user 用户名 密码,密码为空时,用双引号扩起来的空格代替,或者将密码在新行中书写,仅用双引号是无法登录的,仍然会要求输入密码。 |