回复 1# vip_wait - @echo off
- if not exist "X:\" net use X: \\192.168.1.1\xx$ "密码" /user:"用户名"
- >dstdate.vbs echo LastDate=date()-1
- >>dstdate.vbs echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
- >>dstdate.vbs echo wscript.echo FmtDate
- for /f %%a in ('cscript /nologo dstdate.vbs') do set "dstdate=%%a"
- ::如果日期格式为yyyy-mm-dd,修改下面的/为-
- set dstdate=%dstdate:~0,4%^/%dstdate:~4,2%^/%dstdate:~6,2%
- del dstdate.vbs
- cd /d "E:\xxx\"
- set t=0
- for /f "skip=1 tokens=1,3*" %%a in ('dir /tc /a-d ^| find ":"') do >>$ echo %%a "%%c"
- findstr "%date:~,10%" $ >nul && set t=1
- if %t% == 1 (
- for /f "tokens=1*" %%i in ('type $ ^| find "%date:~,10%"') do copy %%j "X:\" /y
- ) else (
- for /f "tokens=1*" %%y in ('type $ ^| find "%dstdate%"') do copy %%z "X:\" /y
- )
- del $
- pause & exit
复制代码
|