本帖最后由 wjx515 于 2012-12-3 14:58 编辑
取前一天日期- @echo off
- ::需要调用VBS
- rem 指定天数
- set DaysAgo=1
- >"%temp%\MyDate.vbs" echo LastDate=date()-%DaysAgo%
- >>"%temp%\MyDate.vbs" echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
- >>"%temp%\MyDate.vbs" echo wscript.echo FmtDate
- for /f %%a in ('cscript /nologo "%temp%\MyDate.vbs"') do (
- set DstDate=%%a
- )
- echo %DstDate%
- pause
复制代码
|