建站优化

当前位置:

wind7批处理设置IP,批处理自动设置局域网ip地址

浏览量:98次

wind7批处理设置IP,批处理自动设置局域网ip地址

wind7批处理设置IP(脚本)

说明:在x.x.x.x处填上自己的IP地址。

保存成“.bat”文件,以管理员身份运行即可。

代码如下:

@echo off

:main

cls

echo 请按提示操作...

echo.

echo 1 STI-HUST

echo 2 Dian-HUST-711

echo 3 DHCP

echo 4 Exit

echo.

set /p choice= Input a number:

echo.

if "%choice%"=="1" goto ip_STI

if "%choice%"=="2" goto ip_Dian711

if "%choice%"=="3" goto ip_DHCP

if "%choice%"=="4" goto ip_Exit

goto main

:ip_STI

echo IP自动设置中...

echo.

echo 更新IP及子网掩码

netsh interface ip set address name="本地连接" source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1

echo 更新DNS服务器

netsh interface ip set dns name="本地连接" source=static addr=x.x.x.x register=PRIMARY

netsh interface ip add dns name="本地连接" addr=x.x.x.x

echo 设置完成

pause

exit

if errorlevel 2 goto main

if errorlevel 1 goto end

:ip_Dian711

echo IP自动设置中...

echo.

echo 更新IP及子网掩码

netsh interface ip set address name="本地连接" source=static addr=x.x.x.x mask=x.x.x.x gateway=x.x.x.x gwmetric=1

echo 更新DNS服务器

netsh interface ip set dns name="本地连接" source=static addr=x.x.x.x register=PRIMARY

netsh interface ip add dns name="本地连接" addr=x.x.x.x

echo 设置完成

pause

exit

if errorlevel 2 goto main

if errorlevel 1 goto end

:ip_DHCP

netsh interface ip set address name="本地连接" source=dhcp

netsh interface ip set dns name="本地连接" source=dhcp

netsh interface ip set wins name="本地连接" source=dhcp

echo 设置完成

pause

exit

if errorlevel 2 goto main

if errorlevel 1 goto end

:ip_Exit

exit

[声明]本网转载网络媒体稿件是为了传播更多的信息,此类稿件不代表本网观点,本网不承担此类稿件侵权行为的连带责任。故此,如果您发现本网站的内容侵犯了您的版权,请您的相关内容发至此邮箱【779898168@qq.com】,我们在确认后,会立即删除,保证您的版权。