以下是根据MAC地址修改IP地址的Win10批处理代码:

@echo off setlocal enabledelayedexpansion

set mac='00-11-22-33-44-55' set newip='192.168.1.100' set subnetmask='255.255.255.0' set gateway='192.168.1.1'

for /f "tokens=2 delims=: " %%a in ('ipconfig /all ^| find "Physical Address"') do ( set curr_mac=%%a set curr_mac=!curr_mac: =! if '!curr_mac!'=='%mac%' ( netsh interface ip set address 'Ethernet' static %newip% %subnetmask% %gateway% 1 echo IP address changed successfully. exit /b ) )

echo MAC address not found. exit /b

请将代码中的'mac'、'newip'、'subnetmask' 和 'gateway' 值替换为实际的MAC地址、新IP地址、子网掩码和网关地址。此脚本将搜索所有网络接口的MAC地址,如果找到匹配的MAC地址,则会将接口的IP地址设置为新的IP地址、子网掩码和网关地址。如果没有找到匹配的MAC地址,则脚本将退出并显示“MAC地址未找到”的消息。请注意,此脚本需要以管理员权限运行。

Win10 批处理: 通过MAC地址修改IP地址

原文地址: https://www.cveoy.top/t/topic/kVNt 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录