批量修改IP及计算机名的批处理文件

求一个批量修改IP及计算机名的批处理文件。

@echo off
rem 修改电脑名
wmic computersystem where "name='%computername%'" call rename "请修改为新电脑名称" >nul
rem 加入工作组
wmic computersystem where name="%computername%" call joindomainorworkgroup name="新的工作组">nul
rem 修改IP/掩码/网関
netsh interface ip set address name="本地连接" source= static add= 192.168.1.10 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
rem 修改NDS
setlocal enabledelayedexpansion
netsh interface ip dump >%tmp%\a.txt
for /f "delims=" %%i in (%tmp%\a.txt) do (
set str=%%i
set str=!str:"=$!
for /f "tokens=1,2 delims=$" %%j in ("!str!") do (
if "%%j"=="# " (
netsh interface ip set dns "%%k" static 请修改为主DNS >NUL
netsh interface ip add dns name="%%k" addr=请修改为辅DNS index=2 >NUL
)
)
)
del /f /q /a %tmp%\a.txt
echo=
echo Dns设定成功!
温馨提示:答案为网友推荐,仅供参考
相似回答