好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

wind7批处理设置IP(脚本) - Windows操作系统 - 自学


wind7批处理设置IP(脚本)

 

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

 

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

 

代码如下: HdhCmsTest2cto测试数据  

 

@echo off

:main

cls

echo 请按提示操作...

echo.

echo 1 STI-HUST

echo 3 DHCP

echo 4 Exit

echo.

set /p choice= Input a number:

echo.

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

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

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

goto main

:ip_STI

echo IP自动设置中...

echo.

echo 更新IP及子网掩码

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

 

echo IP自动设置中...

echo.

echo 更新IP及子网掩码

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
 

查看更多关于wind7批处理设置IP(脚本) - Windows操作系统 - 自学的详细内容...

  阅读:47次