Citation :
Option Explicit
Dim WshShell, WshFS, regex, s, file, ips, ip, list
Set WshShell = CreateObject("WScript.Shell" )
Set WshFS = CreateObject("Scripting.FileSystemObject" )
Set regex = new RegExp
WshShell.Run "command /c ipconfig.exe /all > ipcfg.tmp",2,True
Set file = WshFS.OpenTextFile("ipcfg.tmp",1)
s = file.ReadAll
file.Close
Set file = nothing
WshFS.DeleteFile("ipcfg.tmp" )
regex.pattern = "IP[^0-9]*(192\.168\.[0-5]\.[0-9]{1,3})"
Set ips = regex.execute(s)
For Each ip in ips
list = list & ip.SubMatches(0) & vbcrlf
Next
msgbox list,vbOkOnly,"Adresse IP" 'Ending
Set WshShell = nothing
Set WshFS = nothing
Set regex = nothing
|