2009-08-13

batch file to extract static IP

If you installed VMware in your windows computer, more IPs will be displayed by ipconfig. How to seperate your static IP from VM IP? Good news: all vm IP start with 192.168. See the following batch:




@echo off

IPCONFIG |FIND "IP" | FIND /V "192.168" > %temp%\TEMPIP.txt
FOR /F "tokens=2 delims=:" %%a in (%temp%\TEMPIP.txt) do set IP=%%a
del %temp%\TEMPIP.txt
set IP=%IP:~1%
echo %IP% >%temp%\ip.txt
echo The current IP address is "%IP%"

No comments:

Post a Comment