날자를 월, 일, 년으로 분해하기에서, 오늘의 날자를 해석하기 위해
DoAToday를 생성하고 사용자 암호의 만료기간을 해석하기위해
DoAExpDT를 생성했다.
Windows NT가 암호 만료 경고를 출력하는 시점 변경을 사용함으로서 Windows NT가 암호만료 경고를 출력하는 시점을 설정할 수 있다.
자신의 암호 만료 경고를 출력하려면 날자를 계산할 필요가 있다. Windows NT 명령행 처리기는 그러한 능력을 제공하지 못한다. 따라서 스스로 만들어야 한다.
call DoAExpDT
call XDate %UserName% %XMM% %XDD% %XYY% Day28.DAT Day30.DAT Day31.DAT
여기서
XDate.bat
@echo off
if /i %2 EQU never goto finish
call Todayp %5 %6 %7
if %TDYYP% GTR %4 goto notify
if %TDMMP% GTR %2 goto notify
if %TDDDP% GTR %3 goto notify
goto finish
:notify
call XNotify %1 %2 %3 %4
:finish
Todayp.bat
@echo off
REM Add XX days to today's date based on the Day tables.
REM The 3 Day tables in this example add 10 days.
REM Day31 is for Jan, Mar, May, Jul, Aug, Oct, & Dec.
REM Day30 is for Apr, Jun, Sep, & Nov.
REM Day28 is for Feb. Leap year is ignored.
cd %SystemRoot%\System32\Repl\Import\Scripts
call DoAToday
set TDMMP=%TDMM%
set TDYYP=%TDYY%
goto month%TDMM%
:month01
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month02
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %1') do set TDDDP=%%j
goto year
:month03
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month04
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %2') do set TDDDP=%%j
goto year
:month05
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month06
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %2') do set TDDDP=%%j
goto year
:month07
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month08
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month09
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %2') do set TDDDP=%%j
goto year
:month10
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
goto year
:month11
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %2') do set TDDDP=%%j
goto year
:month12
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDDD%-" %3') do set TDDDP=%%j
:year
if %TDDDP% GTR %TDDD% goto yymmdd
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDMM%-" Month.DAT') do set TDMMP=%%j
If %TDMMP% GTR %TDMM% goto yymmdd
for /f "tokens=1,2 delims=-" %%i in ('findstr /B "%TDYY%-" Year.DAT') do set TDYYP=%%j
:yymmdd
XNotify.bat
@echo off
REM echo %1 %2/%3/%4
REM You can use any form of notification that you wish:
REM Net Send %1 Your password expires on %2/%3/%4. Please change it today.
REM or use a freeware command line mailer like Blat.
Day28.DAT
01-11
02-12
03-13
04-14
05-15
06-16
07-17
08-18
09-19
10-20
11-21
12-22
13-23
14-24
15-25
16-26
17-27
18-28
19-01
20-02
21-03
22-04
23-05
24-06
25-07
26-08
27-09
28-10
Day30.DAT
01-11
02-12
03-13
04-14
05-15
06-16
07-17
08-18
09-19
10-20
11-21
12-22
13-23
14-24
15-25
16-26
17-27
18-28
19-29
20-30
21-01
22-02
23-03
24-04
25-05
26-06
27-07
28-08
29-09
30-10
Day31.DAT
01-11
02-12
03-13
04-14
05-15
06-16
07-17
08-18
09-19
10-20
11-21
12-22
13-23
14-24
15-25
16-26
17-27
18-28
19-29
20-30
21-31
22-01
23-02
24-03
25-04
26-05
27-06
28-07
29-08
30-09
31-10
Month.DAT
01-02
02-03
03-04
04-05
05-06
06-07
07-08
08-09
09-10
10-11
11-12
12-01
Year.DAT - 몇 년만 필요하다. 매1월에 한해를 추가하고 지난 해는 삭제한다.
1998-1999
1999-2000
2000-2001
2001-2002
2002-2003
2003-2004
2004-2005
2005-2006
2006-2007
2007-2008
2008-2009
2009-2010
2010-2011
2011-2012
2012-2013
2013-2014
2014-2015
2015-2016
2016-2017
2017-2018
2018-2019
2019-2010
2020-2021