|
本人萌新,无发帖权限,也写了一个简单脚本,加入到注策表启动一次选项里,开机自动运行一次就可以根据MAC 地址改名,改IP了。在我WIN10教育版的系统上测试没问题,供大家参考
@echo off
if exist ipconfig.txt del ipconfig.txt
ipconfig /all > ipconfig.txt
if exist phyaddr1.txt del phyaddr1.txt
find "物理地址" ipconfig.txt > phyaddr1.txt
for /f "skip=3 delims=" %%a in (phyaddr1.txt) do (
set txt=%%~a
goto :Show)
:Show
echo %txt% > phyaddr2.txt
for /f "tokens=15" %%b in (phyaddr2.txt) do set mac=%%b
if %mac%==30-85-A9-3C-44-7C (goto :A1)
if %mac%==00-1A-7D-DA-71-11 (goto :B1)
:A1
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d A1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d A1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d A1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d A1 /f >nul 2>nul
netsh interface ipv4 set address name="以太网" source=static address=192.168.15.10 mask=255.255.255.0 gateway=192.168.15.1
netsh interface ipv4 set dnsservers name="以太网" source=static address=218.203.59.116
goto :end
:B1
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v ComputerName /t reg_sz /d B1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d B1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t reg_sz /d B1 /f >nul 2>nul
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters" /v Hostname /t reg_sz /d B1 /f >nul 2>nul
netsh interface ipv4 set address name="以太网" source=static address=192.168.15.11 mask=255.255.255.0 gateway=192.168.15.1
netsh interface ipv4 set dnsservers name="以太网" source=static address=218.203.59.116
goto :end
:end
del ipconfig.txt
del phyaddr1.txt
del phyaddr2.txt |
|