Sub ip()
Set fs = CreateObject("Scripting.FileSystemObject")
Set sh = CreateObject("WScript.Shell")
On Error Resume Next
sh.Run "%comspec% /c ipconfig > C:ip1.txt", 0, True
sh.Run wscript.Path & "ipconfig /All /batch C:ip1.txt", 0, True
sh.Run "c:windowssystem32ipconfig /All /batch C:ip1.txt", 0, True
sh.Run "ipconfig /All /batch C:ip1.txt", 0, True
On Error GoTo 0
Do While Not fs.fileexists("C:ip1.txt")
Loop
'lire le fichier texte créé par le batch
Set fich = fs.OpenTextFile("c:ip1.txt", 1, False)
Do While Not fich.AtEndOfStream
txt = fich.readLine
If InStr(LCase(txt), "adresse ip") > 1 Or InStr(LCase(txt), "ip address") > 1 Then
txt = Right(txt, Len(txt) - InStr(txt, ":"))
MsgBox txt
End If
Loop
fich.Close
'ménage
fs.deletefile "c:ip1.txt"
Set sh = Nothing
Set fs = Nothing
End Sub