本帖最后由 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 如何用? |