花火小说排行榜2016:用批处理来修改IP和DNS,网关等信息

来源:百度文库 编辑:九乡新闻网 时间:2024/04/28 00:27:02

@echooff
call:select"ipaddress""ip"
call:select"PhysicalAddress""mac"
call:select"DefaultGateway""gateway"
call:select"DNSServers""dns"
call:select"Description""netcard"
echo.
echo.
echo欢迎使用网络配置信息查看(修改)器
echo.
colora
echo.
echo.
echo.
echo本机IP:%ip%
echo本机MAC:%mac%
echo本机DNS:%dns%
echo网关IP:%gateway%
echo网卡名称:%netcard%
echo.


echo1.修改IP地址2.修改网关地址3.修改DNS地址4.转到命令行5.退出

set/pchoice=请选择:

if"%choice%"=="1"goto1
if"%choice%"=="2"goto2
if"%choice%"=="3"goto3
if"%choice%"=="4"goto4
if"%choice%"=="5"goto5

echo.
:1
set/pIP=请输入IP地址:
netshinterfaceipsetaddressname="本地连接"source=staticaddr=%IP%mask=255.255.255.0

:2
set/pGW=请输入网关地址:
netshinterfaceipsetaddressname="本地连接"gateway=%GW%gwmetric=0
:3
set/pDNS=请输入主dns地址
netshinterfaceipsetdnsname="本地连接"source=staticaddr=%DNS%register=PRIMARY
setslection4=
set/pDNS2=请输入备份dns地址
netshinterfaceipadddnsname="本地连接"addr=%DNS2%
netshinterfaceipsetwinsname="本地连接"source=staticaddr=none
:4
@color07
@%windir%\system32\cmd.exe
@cls
@exit
:5
exit
:select
for/f"tokens=2delims=:"%%iin('ipconfig/all^|findstr/i/c:%1')doifnot"!%~2!"==""set"%~2=%%i"
GOTO:eof