成都创新互联网站制作重庆分公司

windows修改计算机名和ip

@echo off
echo.
echo.
echo 自动修改计算机名和ip
echo.

set /p f=请输计算机的IP后缀(值小于255):
set name= test%f%

set net=本地连接 3
set ip=192.168.10.
set mask=255.255.255.0
set gateway=192.168.10.1
set DNS1=114.114.114.114
set dns2=8.8.8.8

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam" /v @ /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName" /v "ComputerName" /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Eventlog" /v "ComputerName" /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName" /v "ComputerName" /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "NV Hostname" /t REG_SZ /d "%name%" /f >nul 
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v "Hostname" /t REG_SZ /d "%name%" /f >nul
netsh interface ip set address "%net%" static %ip%%f% %mask% %gateway%
netsh interface ip set dns "%net%" static %dns1% primary
netsh interface ip add dns "%net%"  %dns2%

echo 已修改的配置信息如下:
echo.
echo 计算机名       %name%
echo ip             %ip%%f%
echo 掩码           %mask%
echo 网关           %gateway%
echo dns1           %dns1%
echo dns2           %dns2%
echo.
echo "计算机名和ip修改成功"
pause

当前题目:windows修改计算机名和ip
本文路径:http://cxhlcq.com/article/iepjsg.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部