最新消息:我来了,你来了吗

批处理根据MAC自动改IP,计算机名,改IPX(内部网络号)

资源分享 百味人生 1665浏览 0评论

@echo off
MODE con COLS=60 LINES=1 &COLOR 0a
setlocal EnableDelayedExpansion
title 正在配置计算机…..请勿操作!  by longle

set mask=255.255.252.0
set gateway=192.168.1.254
set DNS1=202.96.209.5
set DNS2=202.96.209.133

for /f “tokens=12 delims= ” %%i in (‘ipconfig /all^|find /i “Physical Address”‘) do set mac=%%i
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”
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 %DNS% >nul 2>nul

rem 根据IP改IPX(网络内部号)
ipconfig /all | find /I “IP Address”>IP_.txt
for /f “tokens=15” %%M in (IP_.txt) do set IP=%%M
echo REGEDIT4 >reg.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\NwlnkIpx\Parameters] >>reg.reg
echo “VirtualNetworkNumber”=dword:00000%IP:~10% >>reg.reg
regedit /s reg.reg
del IP_.txt
del reg.reg

pause&exit

rem MAC地址列表,请自己添加修改!
NB-100 192.168.0.100 00-E0-A0-0C-BD-56
wx-011 192.168.0.11  00-14-85-3D-08-6B
NB-102 192.168.0.102 00-E0-A0-0E-DC-8C

pause

 

 

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址