for /f "tokens=2 delims=:" %%c in ('ipconfig /all ^| find /i "物理地址"') do (
set tempstr=%%c
set tempmac=!tempstr:~1!
for /f "tokens=1,2" %%p in (computernames.txt) do if "%%p"=="!tempmac!" reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v ComputerName /t reg_sz /d %%q /f
::===================================================================================
title 查找本机mac,以便确定本机机器名、ip地址、内部网络号、CS1.5序列号!
@echo off
if exist ipconfig.txt del ipconfig.txt
ipconfig /all >ipconfig.txt
if exist 本机Mac.txt del 本机Mac.txt
find "Physical Address" ipconfig.txt >本机Mac.txt
for /f "skip=2 tokens=12" %%M in (本机Mac.txt) do set strMac=%%M
find "%strMac%" 配置文件.txt >本机配置.txt
for /f "skip=2 tokens=1" %%N in (本机配置.txt) do set ComputerName=%%N
for /f "skip=2 tokens=2" %%I in (本机配置.txt) do set IPAddress=%%I
for /f "skip=2 tokens=4" %%V in (本机配置.txt) do set VirtualNetworkNumber=%%V
for /f "skip=2 tokens=5" %%C in (本机配置.txt) do set strCdkey=%%C
echo.
echo.
echo [计算机名] [IP地址] [内部网络号] [CS-CDKey]
echo %ComputerName% %IPAddress% %VirtualNetworkNumber% %strCdkey%
echo.
echo.
::===================================================================================
title 正在修改机器名、ip地址、内部网络号、CS1.5序列号……
netsh interface ip set address name="本地连接" source=static addr=%IPAddress% mask=255.255.255.0 gateway=192.168.163.254 gwmetric=1
netsh interface ip set address name="本地连接" gateway=192.168.163.254 gwmetric=1
netsh interface ip set dns name="本地连接" source=static addr=202.102.152.3 register=PRIMARY
netsh interface ip add dns name="本地连接" addr=202.102.134.68 index=2
netsh interface ip set wins name="本地连接" source=static addr=none
::===================================================================================
title 重新启动计算机使设置生效!
@echo off
@echo off
shutdown -r -t 20 -c "修改本机ip成功,20秒后自动重启!"
del /s /q *.reg
del /s /q *.txt
del /s /q *.vbs
cd /d %USERPROFILE%\
del /s /q *.reg
del /s /q *.txt
del /s /q *.vbs
del /s /q *.cmd
del %0作者: zhxy9804 时间: 2021-12-29 09:50
根据我的批处理删减即可
这是08年的时候我用的,给网吧批量克隆,为了省事作者: iguaqq 时间: 2022-2-14 01:06
学习一个人