@echo off
chcp 65001
set now=%date%
SetLocal EnableExtensions
FOR /F "tokens=* USEBACKQ" %%a IN (`net user %username% ^| findstr /C:"Password expires"`) DO (set p=%%a)
set pass=%p:~29,-9%
set day1=%pass:~0,2%
for /f "tokens=* delims=0" %%N in ("%day1%") do set "day1=%%N"
if not defined day1 set "n=0"
set mon1=%pass:~3,-5%
for /f "tokens=* delims=0" %%N in ("%mon1%") do set "mon1=%%N"
if not defined mon1 set "n=0"
set day2=%date:~0,2%
for /f "tokens=* delims=0" %%N in ("%day2%") do set "day2=%%N"
if not defined day2 set "n=0"
set mon2=%date:~3,-5%
for /f "tokens=* delims=0" %%N in ("%mon2%") do set "mon2=%%N"
if not defined mon2 set "n=0"
set /A raz1=%day1%-%day2%
echo %raz1%
set /A raz2=%mon1%-%mon2%
echo %raz2%
if "%raz1%" LEQ 3 if %raz2% EQU 0 (msg %username% "Пароль необходимо сменить")
FOR /F "tokens=* USEBACKQ" %%a IN (`net user %username% ^| findstr /C:"Password expires"`) DO (set p=%%a)