Another thought, and likely better. The following would assign the static address if no DHCP server is present, and use DHCP if one is present.
Echo off
CLS
rem force attempt to obtain DHCP address even if currently assigned static IP
netsh interface ip set address name = "Local Area Connection" source = dhcp
netsh interface ip set dns name = "Local Area Connection" source = dhcp
netsh interface ip set wins name = "Local Area Connection" source = dhcp
If Exist Result1.txt del Result1.txt
If Exist Result2.txt del Result2.txt
IPConfig >Result1.txt
For /F "tokens=2 delims=:" %%A IN ('Find /I "Address" Result1.txt') DO Echo %%A >Result2.txt
For /F "tokens=1 delims=." %%B IN (Result2.txt) DO SET SubNet=%%B
If %SubNet%==169 GoTo STATIC
GoTo DHCP
:STATIC
rem Echo Subnet is 3
rem enter your lines here for subnet x.x.10.x
netsh interface ip set address name = "Local Area Connection" source = static addr = 10 0.3.16 mask = 255.0.0.0
netsh interface ip set address name = "Local Area Connection" gateway = 10.0.0.254 gwmetric = 1
netsh interface ip set dns name = "Local Area Connection" source = static addr = 4.2.2.2
netsh interface ip add dns name = "Local Area Connection" addr = 4.2.2.3
GoTo END
:DHCP
rem Use currently assigned static IP
:END
Del Result1.txt
Del Result2.txt