上传脚本,ftp_up.bat
@Echo Off
Echo open ip_address >ftp.up
Echo ftp_name>>ftp.up
Echo ftp_password>>ftp.up
Echo Cd .\xxx1\xxx2\xxx3 >>ftp.up
Echo binary>>ftp.up
Echo put "C:\xxx1\xxx2\xxx3\file_name.txt">>ftp.up
Echo bye>>ftp.up
FTP -s:ftp.up
del ftp.up /q
下载脚本,ftp_down.bat,并动态命名文件
@Echo Off
Setlocal EnableDelayedExpansion

REM 设置时间格式
For /F "tokens=1-4 delims=/ " %%A In ('Date/T') Do (
    Set Year=%%C
    Set Month=00%%B
    Set Day=00%%A
    Set Month=!Month:~-2!
    Set Day=!Day:~-2!
)

For /F "tokens=1-3 delims=:." %%A In ("%TIME%") Do (
    Set Hour=00%%A
    Set Minute=00%%B
    Set Second=00%%C
    Set Hour=!Hour:~-2!
    Set Minute=!Minute:~-2!
    Set Second=!Second:~-2!
)

REM FTP下载并动态命名文件
Echo open ip_address > ftp.down
Echo ftp_name>> ftp.down
Echo ftp_password>> ftp.down
Echo Cd .\xxx1\xxx2\xxx3 >> ftp.down
Echo binary>> ftp.down
Echo get "showdoc.db.php" "D:\down_file\1_!Year!!Month!!Day!_!Hour!!Minute!!Second!_file_name.txt">> ftp.down
Echo bye>> ftp.down
FTP -s:ftp.down
del ftp.down /q

注意:不要出现中文路径。