- @echo off
- color 0a
- setlocal EnableDelayedExpansion
- set MASK=255.255.255.0
- set GATEWAY=192.168.123.254
- set DNS1=202.99.192.68
- set DNS2=219.150.32.132
- echo.
- echo. 完成获取资料,请检查正确后按确认键开始执行修改任务
- echo.*************************************************************************
- echo.
- for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%i
- echo. 本机 MAC地址 (硬件获取): %Mac%
- for /f "tokens=1,2*" %%i in ('ipconfig /all^|find "Ethernet adapter"') do set Ethernet=%%k
- for /f "tokens=1,2" %%i in ('more /e +13 %0 ^|find /i "%mac:~,-1%"') do set "name=%%i"&set
-
- "IP=%%j"
- echo 本机 IP 地址 (动态获取): %ip%
- echo.
- echo.*************************************************************************
- pause
- reg add
-
- "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v
-
- ComputerName /t reg_sz /d %name% /f >nul 2>nul
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV
-
- Hostname" /t reg_sz /d %name% /f >nul 2>nul
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname
-
- /t reg_sz /d %name% /f >nul 2>nul
- netsh interface ip set address "%Ethernet:~,-2%" static %IP% %Mask% %GATEWAY% 1 >nul
-
- 2>nul
- netsh interface ip set dns "%Ethernet:~,-2%" static %DNS1% >nul 2>nul
- netsh interface ip set dns "%Ethernet:~,-2%" static %DNS2% >nul 2>nul
- pause&exit
- NB-100 192.168.0.100 00-E0-A0-0C-BD-56
- NB-101 192.168.0.101 00-1A-4D-9C-82-87
- NB-105 192.168.1.102 00-e0-4d-a6-10-8f
复制代码
综合一下。呵呵
[ 本帖最后由 6589600 于 2008-12-4 01:13 编辑 ] |