first:
if not "%errorlevel%" == "0" goto factory
is same as:
if "%errorlevel%"=="1" goto factory

also, try taking of the ">nul"
it can reset the errorlevel.
if this is the reason you can do:
@echo off
before the ipcheck

cheers½
_________________________
!

download KiXnet