没事帮你写一个,呵呵。
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1-8 delims=-/:. " %%a in ("%date% %time%") do (call :datetosecs %%a %%b %%c %%e %%f %%g sec1&set "today=%%a-%%b-%%c %%e:%%f:%%g")
for /f "tokens=1-6 delims=-/:. " %%a in ("%~t0") do (call :datetosecs %%a %%b %%c %%e %%e 0 sec0)
::30天到期修改此处
set /a out=30*24*3600+sec0&call :SecsToDate !out! y1 m1 d1 hh1 mm1 ss1
::倒计时时间
set /a free=(out-sec1)/3600/24
::即将到期警告时间
set /a zy=out-5*3600
echo 启用时间:%~t0:00
echo 到期时间:!y1!-!m1!-!d1! !hh1!:!mm1!:!ss1!
echo 当前时间:!today!
if !sec1! gtr !zy! (echo 注意:到期只有!free!天,请尽快充值!:D) else echo 您还能免费享受:!free!天
::到期处理
if !sec1! gtr !out! (
echo 已到期,进入自杀模式,请稍等...
ping 127.0.0.1 -n 2 >nul 2>nul
echo bye bye!
del /Q XXX.bat
)
::以下写主程序或用call start命令
goto: eof
:datetosecs
setlocal ENABLEEXTENSIONS
set yy=%1&set mm=%2&set dd=%3&set hh=%4&set nn=%5&set ss=%6
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
if 1%hh% LSS 20 set hh=0%hh%
if {%nn:~2,1%} EQU {p} if "%hh%" NEQ "12" set hh=1%hh%&set/a hh-=88
if {%nn:~2,1%} EQU {a} if "%hh%" EQU "12" set hh=00
if {%nn:~2,1%} GEQ {a} set nn=%nn:~0,2%
set /a hh=100%hh%%%100,nn=100%nn%%%100,ss=100%ss%%%100
set /a j=j*86400+hh*3600+nn*60+ss
endlocal&set %7=%j%&goto :EOF
:SecsToDate
set /a i=%1,ss=i%%60,i/=60,nn=i%%60,i/=60,hh=i%%24,dd=i/24,i/=24
set /a a=i+2472632,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
(if %hh% LSS 10 set hh=0%hh%)&(if %nn% LSS 10 set nn=0%nn%)
if %ss% LSS 10 set ss=0%ss%
endlocal&set %7=%ss%&set %6=%nn%&set %5=%hh%&^
set %4=%dd%&set %3=%mm%&set %2=%yy%&goto :EOF