欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

bat获取明天日期

程序员文章站 2022-05-01 12:42:58
...
echo Wscript.echo dateadd("d",1,date)>vbs.vbs
for /f %%a in ('cscript /nologo vbs.vbs') do del vbs.vbs&&set yyyymmdd=%%a
for /f "tokens=1,2,3* delims=// " %%i in ('echo %yyyymmdd%') do set yyyy=%%i&set mm=%%j&set dd=%%k
if   %mm%   LSS   9   set   mm=0%mm%
if   %dd%   LSS   9   set   dd=0%dd%
set tomorrow=%yyyy%-%mm%-%dd%
echo tomorrow is : %tomorrow%

如果要在CMD里逐行执行要把%%改成%

echo Wscript.echo dateadd("d",1,date)>vbs.vbs
for /f %a in ('cscript /nologo vbs.vbs') do del vbs.vbs&&set yyyymmdd=%a
for /f "tokens=1,2,3* delims=// " %i in ('echo %yyyymmdd%') do set yyyy=%i&set mm=%j&set dd=%k
if   %mm%   LSS   9   set   mm=0%mm%
if   %dd%   LSS   9   set   dd=0%dd%
set tomorrow=%yyyy%-%mm%-%dd%
echo tomorrow is : %tomorrow%
相关标签: batch