@echo off
for /f "tokens=2" %%i in ('net user test ^|find "密码到期"') do set a=%%i
for /f "delims=/ tokens=1,2,3" %%i in ('echo %a%') do (
set uy=%%i
set um=%%j
set ud=%%k
)
if /i %um% lss 10 (
set um=0%um%
)
if /i %ud% lss 10 (
set ud=0%ud%
)
set sy=%date:~0,4%
set sm=%date:~5,2%
set sd=%date:~8,2%
set num2=%uy%%um%%ud%
echo %num%
set num=%sy%%sm%%sd%
echo %num2%
set y=%num:~,4%
set m=%num:~4,2%
set d=%num:~6,2%
set a=dateserial(%y%,%m%,%d%)
set y2=%num2:~,4%
set m2=%num2:~4,2%
set d2=%num2:~6,2%
set b=dateserial(%y2%,%m2%,%d2%)
echo wscript.echo datediff("d",%a%,%b%)>t.vbs
for /f %%i in ('cscript /nologo t.vbs') do echo 日期差 %%i
pause