中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [求助]初学者请教关于dos下自动下载ftp的问题
作者:
标题: [求助]初学者请教关于dos下自动下载ftp的问题 上一主题 | 下一主题
caicainancy
新手上路





积分 6
发帖 2
注册 2008-5-14
状态 离线
『楼 主』:  [求助]初学者请教关于dos下自动下载ftp的问题 使用 LLM 解释/回答一下

我想弄一个自动下载ftp数据的批处理程序。
我在cmd.exe里通过一步步的录入命令是能够下载的,如:
ftp ***.***.***.*** 回车
username 回车
password 回车
cd path 回车
get file 回车
.......
我想通过批处理,自动下载,但除了 ftp ***.***.***.***,是dos命令之外,其他的都是ftp服务器自带的命令了,无法自动录入,我对代码是这样写的。
@echo on
ftp ***.***.***.***
username
password
PAUSE
这里的用户名和密码都无法自动的录入,所以请教大虾一下,如何实现在光标闪烁处自动录入想要录入的字符,先感谢大家了。


2008-5-14 16:55
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
pooronce
中级用户





积分 484
发帖 250
注册 2007-6-5
状态 离线
『第 2 楼』:   使用 LLM 解释/回答一下

注意-s 参数的说明

C:\WINDOWS>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.


2008-5-14 17:07
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复
HAT
版主





积分 9023
发帖 5017
注册 2007-5-31
状态 离线
『第 3 楼』:   使用 LLM 解释/回答一下

@echo off
set DstFile=%temp%\TempAcc.txt
>"%DstFile%" echo USERNAME
>>"%DstFile%" echo PASSWORD
>>"%DstFile%" echo bin
>>"%DstFile%" echo get *.txt
start ftp -v -s:"%DstFile%" IPADDRESS
del /q "%DstFile%"
exit


2008-5-14 17:08
查看资料  发短消息  网志   编辑帖子  回复  引用回复
caicainancy
新手上路





积分 6
发帖 2
注册 2008-5-14
状态 离线
『第 4 楼』:   使用 LLM 解释/回答一下

非常感谢2楼和3楼的回复,我爱你们。


2008-5-14 17:16
查看资料  发送邮件  发短消息  网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: