@echo off set ftpfile=putfiles.ftp set logfile=putfiles.log echo open 192.168.0.1 > "%ftpfile%" rem 把下面行中的 username和password改为你的用户名和密码 echo user username password >> "%ftpfile%" rem ------------------------------ echo bin >> "%ftpfile%" rem 进入FTP server 中的"X"目录 echo cd X >> "%ftpfile%" //如果服务器已经对ftp上传文件进行了配置rem echo cd X >> "%ftpfile%" 注释该行 rem ------------------------------ rem 进入本地C盘根目录 echo lcd c:/ >> "%ftpfile%" rem ------------------------------ echo put A.TXT >> "%ftpfile%" echo quit >> "%ftpfile%" echo -------------------------------- >> "%logfile%" date /t >> "%logfile%" time /t >> "%logfile%" echo -------------------------------- >> "%logfile%" ftp -n < "%ftpfile%" >> "%logfile%" del "%ftpfile%" @echo on rem -----------脚本结束---------------