IP 地址切换脚本

@echo off
color 00
mode con cols=80 lines=30
title IP模式切换脚本
:start
cls
echo=
echo ============================================================================
echo=
echo 1.上传大文件模式
echo=
echo 2.研发区办公模式(DHCP)
echo=
echo 3.退出
echo=
echo
echo=
echo ============================================================================
echo=
set choice=
set /p choice=请输入你的选择:
if "%choice%"=="1" goto work
if "%choice%"=="2" goto dhcp
if "%choice%"=="3" exit
echo 输入有误,请重新选择!
pause>nul
goto start

:work
cls
cls
echo.
echo 正在切换至上传大文件模式请等待...
echo.
set net_interface="以太网"
echo 设置IP、网关中...
netsh interface ip set address "%net_interface%" static 172.16.42.42 255.255.255.0 172.16.42.1
echo 设置DNS中...
netsh interface ip set dns "%net_interface%" static 202.96.134.133
echo IP已成功切换至上传大文件模式,任意键返回...
pause>nul
goto start


:dhcp
cls
echo.
echo 正在切换至研发区办公模式(DHCP)请等待...
echo.
set net_interface="以太网"
echo 设置IP、网关中...
netsh interface ip set address "%net_interface%" dhcp
echo 设置DNS中...
netsh interface ip set dns "%net_interface%" dhcp
echo IP已成功切换至研发区办公模式,任意键返回...
pause>nul
goto start

posted @ 2022-10-28 21:12  walkersss  阅读(309)  评论(0编辑  收藏  举报