Dim str As String
str = ""
Dim checkStr As String
checkStr = "192.168.1."
Dim prefix As String
prefix = "route add 10.50.82.0 mask 255.255.255.0 "
Dim idx As Integer
Open "c:\ipconfig.txt" For Input As #1
Open "c:\ip.txt" For Output As #2
Do
idx = -1
Input #1, str
idx = InStr(str, checkStr)
If idx > 0 Then
Print #2, Mid(str, idx)
End If
Loop Until EOF(1)
Close #2
Close #1
-- 把ip写进bat file 里, 然后执行
Open "c:\ip.bat" For Output As #3
Open "c:\ip.txt" For Input As #4
Do
Input #1, str
Print #2, prefix & str
Loop Until EOF(4)
Close #3
Close #4
Call Shell("c:\ip.bat", vbNormalFocus)