for /f "tokens=2-3 skip=3 delims=." %%a in ('ping -n 1 %computername% -4') do ( set ip=%%b goto end) :end echo %ip%