Rel*_*lla 6 windows ftp batch-file
如何创建.BAT文件以从FTP服务器下载文件或文件夹?(并用现有文件替换)(我们有像ftp://me:mypass@example.com/file.file(或http://example.com/file.file)和绝对文件链接之类的链接C:\Users\UserName\Some mixed ??????? English Adress\file.file)(仅使用本机窗口(xp vista win7等)BAT功能和文件)
以下是如何自动化内置ftp.exe工具的示例:
示例是关于上传,但原理是相同的(只是使用get而不是put).
但是,由于这只是"管道命令"到ftp.exe中,我建议不要为生产质量的批处理文件(没有错误处理等)执行此操作,而是使用一些外部工具.我提供此答案只是因为您明确要求使用仅使用Windows内置命令的解决方案.
编辑:这是一个具体的例子:
REM replace this with your user name and password
REM make sure there is no space between the pwd and the >>
echo user me > getftp.dat
echo mypass>> getftp.dat
echo binary >> getftp.dat
REM replace this with the remote dir (or remove, if not required)
echo cd remoteSubDir >> getftp.dat
REM replace this with the local dir
echo lcd C:\Users\UserName\SomeLocalSubDir >> getftp.dat
REM replace this with the file name
echo get file.file >> getftp.dat
echo quit >> getftp.dat
REM replace this with the server name
ftp -n -s:getftp.dat example.com
del getftp.dat
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
48093 次 |
| 最近记录: |