::First case: sequential writing, with blank lines between each section.
@echo off
for /l %%i in (1,1,255) do (
echo IP=192.168.0.%%i>>Wattcp.cfg
echo NETMASK=255.255.255.0>>Wattcp.cfg
echo GATEWAY=192.168.0.1>>Wattcp.cfg
echo.>>Wattcp.cfg
)
::Second case: writing random numbers. Since you're using IP addresses as the basis, there can't possibly be an IP like 192.168.1.263563, right? So we can only make do with the following to implement randomness.
@echo off
setlocal
echo.>Wattcp.cfg
:B
set /a p+=1
if p==5 goto :eof
set ii=%random:~0,3%
if %ii% leq 255 (
for /f "tokens=1,2* delims==" %%i in ('findstr /x "IP=192.168.0.%ii%" Wattcp.cfg') do set uu=%%j
if "%uu%"=="192.168.0.%ii%" goto A
echo IP=192.168.0.%ii%>>Wattcp.cfg
echo NETMASK=255.255.255.0>>Wattcp.cfg
echo GATEWAY=192.168.0.1>>Wattcp.cfg
echo.>>Wattcp.cfg
) else (
goto A
)
:A
set i=%random:~0,2%
set k=%random:~0,1%
for /f "tokens=1,2* delims==" %%i in ('findstr /x "IP=192.168.0.%i%" Wattcp.cfg') do set uu=%%j
if "%uu%"=="192.168.0.%i%" goto B
echo IP=192.168.0.%i%>>Wattcp.cfg
echo NETMASK=255.255.255.0>>Wattcp.cfg
echo GATEWAY=192.168.0.1>>Wattcp.cfg
echo.>>Wattcp.cfg
for /f "tokens=1,2* delims==" %%i in ('findstr /x "IP=192.168.0.%k%" Wattcp.cfg') do set uu=%%j
if "%uu%"=="192.168.0.%k%" goto B
echo IP=192.168.0.%k%>>Wattcp.cfg
echo NETMASK=255.255.255.0>>Wattcp.cfg
echo GATEWAY=192.168.0.1>>Wattcp.cfg
echo.>>Wattcp.cfg
goto B
This is about as far as I can write it in batch.................