Nos creamos un script batch. Para ello, con el notepad nos greamos un
fichero llamado getIP.cmd y le copiamos el siguiente contenido:
@echo off
setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "j="
for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1")
endlocal & echo %i% & pause & goto :EOF
La ejecucion del comando nos dará la IP principal.
Jose Manuel Tella Llop
MVP - Windows
jmtella@XXXcompuserve.com (quitar XXX)
http://www.multingles.net/jmt.htm
Este mensaje se proporciona "como está" sin garantías de ninguna clase,
y no otorga ningún derecho.
This posting is provided "AS IS" with no warranties, and confers no
rights.
You assume all risk for your use.
Leer las respuestas