If you're using WinPE, you will need to initialize the networking first by running:

wpeinit

Here is a batch file example for setting the IP using command line:

@echo off
if "%1"=="static" goto static
if "%1"=="dhcp" goto dhcp
echo Usage: %0 (static^|dhcp)
goto end2
:static
echo Setting static IP of 192.168.xxx.xxx
netsh int ipv4 set address "Local Area Connection" static 192.168.xxx.xxx 255.255.255.0 192.168.xxx.xxx 1
echo Setting primary DNS server to 192.168.xxx.xxx
netsh int ipv4 set dnsservers "Local Area Connection" static 192.168.xxx.xxx primary
goto end
:dhcp
echo Setting Dynamic (DHCP) IP
netsh int ipv4 set address "Local Area Connection" dhcp
echo Setting Dynamic (DHCP) DNS
netsh int ipv4 set dnsservers "Local Area Connection" dhcp
goto end
:end
echo Waiting for IP config to update...
@choice /c 12 /T 3 /d 1 >  NUL
ipconfig /all
pause
:end2