【求助】用Ping来判断IP地址的通否来自动切换IP设置
本帖最后由 cityofthesky 于 2010-12-27 10:36 编辑While 1
$p=ping("192.168.1.1",250)
$q=ping("10.10.0.1",250)
If $p <> 0 Or $q <> 0 Then
ExitLoop
ElseIf $p = 0 And $q = 0 Then
$Rs=Random(100,199,1)
ToolTip(@CR&"正在设置网卡ip "&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip set address "本地连接" static 192.168.1.' & $Rs & ' 255.255.255.0 192.168.1.1 auto ',"", @SW_HIDE )
ToolTip(@CR&"正在设置网络dns "&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip set dns "本地连接" static 222.34.29.158 ',"", @SW_HIDE )
ToolTip(@CR&"正在设置网络备用dns"&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip add dns "本地连接" 222.34.29.166 ',"", @SW_HIDE )
EndIf
$w=ping("192.168.1.1",250)
If $w = 0 Then
$Rs=Random(100,199,1)
ToolTip(@CR&"正在设置网卡ip "&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip set address "本地连接" static 10.0.0.' & $Rs & ' 255.255.255.0 10.0.0.1 auto ',"", @SW_HIDE )
ToolTip(@CR&"正在设置网络dns "&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip set dns "本地连接" static 10.161.32.86 ',"", @SW_HIDE )
ToolTip(@CR&"正在设置网络备用dns"&@CR,@DesktopWidth-260, @DesktopHeight-120)
RunWait(@ComSpec & ' /C netsh interface ip add dns "本地连接" 10.161.32.86 ',"", @SW_HIDE )
EndIf
WEnd怎么加入循环呢?ExitLoop 如何用? 怎么循环的,看不太懂 在endif里面加exitloop 神呐,救救我吧 有没有视频教程 我急需一个程序自动修改路由器配置
页:
[1]