Board logo

标题: [原创].bat获取adsl动态ip [打印本页]

作者: vkill     时间: 2006-8-22 13:36    标题: [原创].bat获取adsl动态ip

献给需要的朋友 by:Ye - *

主要三个文件,都在%windir%目录下,ftp ip:192.168.0.1  name:admin password:pass

at.bat

  Quote:
@echo off
rem 开机10分钟后执行%windir%\up.bat ,xp下测试,时间24小时制
set h=%time:~0,2%
set /a m=%time:~3,2%+10
if %m% GEQ 60 (set /a m=m-60 & set /a h=h+01)
if %m% lss 10 (set /a m=m+10)
if %h% EQU 24 (set a=00)
set xtime=%h%%time:~2,1%%m%
at.exe %xtime% /interactive %windir%\up.bat

up.bat

  Quote:
@echo off
echo set dns=%%2 >ping.bat
ping.exe -n 1 163.com |find /i "ping" >temp.bat
ren %windir%\system32\ping.exe ping_.exe
call temp.bat
ren %windir%\system32\ping_.exe ping.exe
if %dns%==for (cd %windir%
echo %date% %time% >>ip.txt
ipconfig /all >>ip.txt
ftp -n -s:up.scr 192.168.0.1
) else (call at.bat)

up.scr

  Quote:
user admin
pass
put ip.txt
quit

[ Last edited by he200377 on 2006-8-27 at 20:48 ]
作者: vkill     时间: 2006-8-23 21:46
再测试下

[ Last edited by he200377 on 2006-8-27 at 20:44 ]