- @echo off
- echo 正在配置IP地址、DNS请稍候……
- set MASK=255.255.255.0
- set GATEWAY=192.168.103.254
- set DNS1=202.96.128.143
- set DNS2=202.96.128.68
- set WINS=192.168.103.254
- for /f "tokens=12 delims= " %%i in ('ipconfig /all^|find /i "Physical Address"') do set mac=%%i
- more +22 "%~f0" | findstr "%mac%" || pause && goto :eof
- 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 +22 %0 ^|find /i "%mac:~,-1%"') do set "name=%%i"&set "IP=%%j"
- for /f "tokens=4" %%j in ('more /e +22 %0 ^|find /i "%mac:~,-1%"') do set "p=%%j"
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\lanmanserver\parameters" /v srvcomment /t reg_sz /d %p% /f >nul 2>nul
- reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters" /v srvcomment /t reg_sz /d %p% /f >nul 2>nul
- reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /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% register=PRIMARY >nul 2>nul
- netsh interface ip add dns "%Ethernet:~,-2%" %DNS2% index=2 >nul 2>nul
- netsh interface ip set wins "%Ethernet:~,-2%" static %WINS% >nul 2>nul
- exit
- A01 192.168.103.101 10-60-4b-77-fe-a0 北三楼A01
- A02 192.168.103.102 10-60-4b-8b-50-be 北三楼A02
- A03 192.168.103.103 10-60-4b-88-61-7f 北三楼A03
- A04 192.168.103.104 10-60-4b-88-70-a6 北三楼A04
- A05 192.168.103.105 10-60-4B-89-46-CE 北三楼A05
- A06 192.168.103.106 10-60-4b-8b-51-3f 北三楼A06
- A07 192.168.103.107 10-60-4b-8b-53-cd 北三楼A07
- A08 192.168.103.108 10-60-4b-8b-51-38 北三楼A08
- A09 192.168.103.109 10-60-4b-77-e5-c4 北三楼A09
- A10 192.168.103.110 10-60-4b-77-ea-c2 北三楼A10
- B01 192.168.103.111 10-60-4b-77-e7-e6 北三楼B01
- B02 192.168.103.112 10-60-4b-77-fe-80 北三楼B02
- B03 192.168.103.113 10-60-4b-88-5e-cc 北三楼B03
- B04 192.168.103.114 10-60-4b-77-ea-a9 北三楼B04
- B05 192.168.103.115 10-60-4b-77-fe-9e 北三楼B05
- B06 192.168.103.116 10-60-4b-77-e7-eb 北三楼B06
- B07 192.168.103.117 10-60-4b-88-70-a1 北三楼B07
- B08 192.168.103.118 10-60-4b-8b-50-99 北三楼B08
- B09 192.168.103.119 10-60-4b-86-2f-d2 北三楼B09
- B10 192.168.103.120 10-60-4b-77-fe-f4 北三楼B10
复制代码
|