¿Cómo obtener la dirección IP de la "Conexión de área local" usando el script bat o VBS?
Establecer WshShell = WScript.CreateObject("WScript.Shell")
Establecer oExec = WshShell.Exec("ipconfig.exe")
Establecer oStdOut = oExec.StdOut
ip = ""
Hacer hasta oStdOut.AtEndOfStream
strLine = oStdOut.ReadLine
Si InStr(strLine, "Conexión de área local") gt; 0 Entonces
strLine = oStdOut.ReadLine
strLine = oStdOut.ReadLine
strLine = oStdOut.ReadLine
ip = Mid(strLine, InStr(strLine, ":") 2)
Salir Do
End If
Bucle
Si ip = "" Entonces
MsgBox "¡Error al obtener la dirección IP de la conexión local!", vbExclamation, "Error"
WScript.Quit
Else
p>MsgBox ip, vbExclamation, ip
Finalizar si
WScript.Quit