@echo off for /F "usebackq" %%R in (`wmic PATH Win32_NetworkAdapterConfiguration WHERE "IPEnabled = True and not MACAddress like '00:%'" get Ipaddress`) do ( rem echo OUTPUT is %%R set IP=%%R echo %%R )
The above script will exclude virtual NIC (00 :) other types of virtual network card to add their own