首页 > 技术文章 > bat批处理设置静态、动态、ping、查看网络配置

ClassNotFoundException 2017-03-30 16:37 原文

@echo off
:startIP
set /p source=S or D or C or P or E:
echo source:%source%
if /i "%source%" == "S" ( goto staticIP )
if /i "%source%" == "D" ( goto dhcpIP )
if /i "%source%" == "C" ( goto ipconfig )
if /i "%source%" == "P" ( goto ping )
if /i "%source%" == "e" ( goto exitSet )
:staticIP
set /p IP=IP:
netsh interface ip set address name="本地连接" source=static addr=%IP% mask=255.255.255.0 gateway=192.168.10.1
goto startIP
:dhcpIP
netsh interface ip set address name="本地连接" source=dhcp
goto startIP
:ipconfig
ipconfig
goto startIP
:ping
set /p TARGET=TARGET:
ping %target%
goto startIP
:exitSet
exit
@Rem @netsh interface ip set dns name="本地连接" source=static addr=192.168.10.1

啦啦啦

推荐阅读