批处理文件从FTP下载文件 [英] Batch file to download a file from FTP
问题描述
我想用2分钟的步骤下载abcd.txt文件'n'次。
以下是我创建的用于从FTP下载文件的批处理文件(带有ftp脚本)。
:DOWNLOAD_AGAIN
@ftp -i -s:%〜f0& GOTO:DOWNLOAD_AGAIN
打开192.168.4.4
用户名
密码
!: - - 下面的FTP命令---
cd / data /
pwd
get abcd.txt
bye
问题是,
1)上面的批处理文件不会等待2分钟,它会立即开始再次下载文件。
2)我不知道如何限制它只下载'n'次。
任何帮助!
Thanks!
PING可以用来延迟执行几秒钟。
如果指定(-w开关),PING将在发出超时之前等待两个ping之间的毫秒数。
即, PING 127.0.0.1 -n 6延迟5秒。
或
PING 1.1.1.1 -n 1 -w 60000> NUL
将会延迟下一个命令的执行60秒,前提是1.1.1.1不是有效的IP地址
也可以使用
TIMEOUT 120
将下一个命令的执行延迟120秒
并且为了运行n次
的批次,你可以做
$ b $ pre $ FOR / L%i IN(1, 1,n)DO(
//给东西
)
1 ,1,n被解码为:
(start,step,end)
i want to download the "abcd.txt" file 'n' times with step of 2 mins. Following is the batch (with ftp script in it) file i've created to download a file from FTP.
:DOWNLOAD_AGAIN
@ftp -i -s:"%~f0"&GOTO:DOWNLOAD_AGAIN
open 192.168.4.4
username
password
!:--- FTP commands below here ---
cd /data/
pwd
get abcd.txt
bye
The problem is, 1) Above batch file does not wait for 2 mins, it immediately starts downloading the file again. 2) I dont know how to restrict it to download only 'n' times.
Any help! Thanks!
PING can be used to delay execution for a number of seconds. If specified (-w switch), PING will wait for a number of milliseconds between two pings before giving a time-out.
i.e. PING 127.0.0.1 -n 6 for a 5 seconds delay. or PING 1.1.1.1 -n 1 -w 60000 >NUL will delay execution of the next command 60 seconds, provided 1.1.1.1 is not a valid IP address
Also you can use TIMEOUT 120 will delay execution of the next command by 120 seconds
And for running batch for n times you can do
FOR /L %i IN (1,1,n) DO (
//to stuff
)
The 1,1,n is decoded as:
(start,step,end)
这篇关于批处理文件从FTP下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!