windows bat 脚本实现FTP自动下载上传
1. 自动下载
batch
# 示例:实现自动下载
@echo Off
echo open 192.168.137.102>>ftp.txt
echo admin>>ftp.txt
echo admin12345>>ftp.txt
echo lcd D:\>>ftp.txt
echo cd /admin/1>>ftp.txt
echo bin>>ftp.txt
echo get 11>>ftp.txt
echo bye>>ftp.txt
ftp -s:ftp.txt
或者使用如下格式
batch
# 准备 ftp.txt 文件
open 192.168.137.102
admin
admin12345
prompt off
lcd D:\
cd /admin/1
bin
mget 11
bye
quit
@echo off
ftp -s:C:\Users\Dxx\Desktop\ftp.txt
2. 自动上传
batch
@echo off
echo open 192.168.137.102>>ftpPut.txt
echo admin>>ftpPut.txt
echo admin12345>>ftpPut.txt
echo lcd D:\ftp>>ftpPut.txt
echo cd admin/1>>ftpPut.txt
echo prompt off>>ftpPut.txt
echo put 12.txt>>ftpPut.txt
echo bye>>ftpPut.txt
echo quit>>ftpPut.txt
ftp -s:ftpPut.txt