1、编写ftp的bat脚本:
set year=%date:~0,4% set day=%date:~0,4%%date:~5,2%%date:~8,2% mkdir d:\ftp\%date:~0,4% mkdir d:\ftp\%date:~0,4%\%date:~0,4%%date:~5,2%%date:~8,2% del d:\ftp\ftpcmd.txt @echo open 172.18.73.122>>ftpcmd.txt @echo product1>>ftpcmd.txt @echo product1>>ftpcmd.txt @echo binary>>ftpcmd.txt @echo cd /products/Grib2/Grid_SM/%year%/%day%>>ftpcmd.txt @echo lcd D:/ftp/%year%/%day%>>ftpcmd.txt @echo prompt off>>ftpcmd.txt @echo mget *>>ftpcmd.txt @echo bye>>ftpcmd.txt @echo quit>>ftpcmd.txt @echo close>>ftpcmd.txt ftp -s:D:/ftp/ftpcmd.txt
2、讲脚本另存为run.bat文件,然后添加到windows的计划任务里面,但是有几个注意事项,如下:
(1)点击创建任务
如图所示的勾选,不存储密码。
(2)操作,在“起始于(可选)”这里一定要填写相应执行程序或是BAT文件的所在目录,要不然是执行不成功的。
原文地址:https://www.cnblogs.com/tiandi/p/11965278.html
时间: 2024-10-10 00:11:51