::-----bo Batchl.... @echo off SETLOCAL ENABLEDELAYEDEXPANSION :: Format of SetupIPs_Config.txt WORKGROUP MASK GATE DNS1 DNS2 INTERFACE CLEANUP REBOOT :: Format of SetupIPs_Data.txt MAC IP NAME ::Read WORKGROUP cat SetupIPs_Config.txt | head -1 | tail -1 >"tmp.txt" set /p WORK="tmp.txt" set /p MASK="tmp.txt" set /p GATE="tmp.txt" set /p DNS1="tmp.txt" set /p DNS2="tmp.txt" set /p INTERFACE="tmp.txt" set /p CLEAN="tmp.txt" set /p REBOOT=NUL ^| FINDSTR /R /I /C:"[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]-*[0-9A-F][0-9A-F]"') DO FOR %%B IN (%%A) DO SET MACAddress=%%B ::Reading MACs set i=0 for /f "tokens=1" %%a in ('type SetupIPs_Data.txt') do ( set /a i+=1 if %MACAddress%==%%a ( cat SetupIPs_Data.txt | head -!i! | tail -1 >"tmp.txt" for /f "tokens=2" %%b in ('type tmp.txt') do ( echo Setup IP,MASK,GATEWAY netsh interface ip set address name="%INTERFACE%" static %%b %MASK% %GATE% 1 ) echo Setup PRIMARY DNS netsh interface ip set dns name = "%INTERFACE%" source = static addr = %DNS1% echo Setup SECONDARY DNS netsh interface ip add dns name = "%INTERFACE%" addr = %DNS2% echo Setup WORKGROUP netdom.exe MEMBER \\%ComputerName% /JOINWorkgroup %WORK% for /f "tokens=3" %%c in ('type tmp.txt') do ( echo Setup COMPUTER NAME wmic.exe ComputerSystem Where Name="%ComputerName%" Rename Name="%%c" ) attrib -r -h -s tmp.txt DEL tmp.txt IF %REBOOT%==1 shutdown -r -f -t 5 -c "Computer Name and Network Configuration Complete" IF %CLEAN%==1 ( attrib -r -h -s attrib -r -h -s cat.exe DEL cat.exe attrib -r -h -s head.exe DEL head.exe attrib -r -h -s tail.exe DEL tail.exe attrib -r -h -s libiconv2.dll DEL libiconv2.dll attrib -r -h -s libintl3.dll DEL libintl3.dll attrib -r -h -s SetupIPs_Config.txt DEL SetupIPs_Config.txt attrib -r -h -s SetupIPs_Data.txt DEL SetupIPs_Data.txt attrib -r -h -s NetDomNT4.exe DEL NetDomNT4.exe attrib -r -h -s "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup\CPAU - SetupIPs.lnk" DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup\CPAU - SetupIPs.lnk" attrib -r -h -s DEL %0 ) ) ) goto :eof ::-----eo Batch....