windows下设置网络pingIP地址

    xiaoxiao2022-07-03  135

    “以太网” 为网卡名称,“E:/iptest/iplist.txt”里存放需要ping的ip地址,每行一个

    @echo off :main echo ================ echo 1:网络设置 echo 2:自动获取IP echo 3:Ping Ip地址 echo 4:初始化网路设置 echo 5:结束 echo ================ set /p choice=你的选择: echo. if "%choice%"=="1" goto initSet if "%choice%"=="2" goto dhcpIp if "%choice%"=="3" goto pingIp if "%choice%"=="4" goto dhcpSet if "%choice%"=="5" goto end :initSet echo IP自动设置开始.... echo. echo 正在设置IP及子网掩码 cmd /c netsh interface ip set address name="以太网" source=static addr=172.168.1.101 mask=255.255.255.0 gateway=172.168.1.1 gwmetric=1 echo 正在设置DNS服务器 cmd /c netsh interface ip set dns name="以太网" source=static addr=192.168.1.1 register=PRIMARY echo 正在设置DNS服务器 cmd /c netsh interface ip add dns name="以太网" addr=172.168.1.1 set err=%errorlevel% if "%err%"=="0" ( echo 设置成功 goto main ) else if "%err%"=="1" ( echo 设置失败 goto main ) else ( echo 错误码:%errorlevel% goto main ) :dhcpIp echo IP自动设置开始.... echo. echo 自动获取IP地址.... netsh interface ip set address name = "以太网" source = dhcp echo 自动获取DNS服务器.... netsh interface ip set dns name = "以太网" source = dhcp [@rem](https://my.oschina.net/u/196541) 设置自动获取IP set err=%errorlevel% if "%err%"=="0" ( echo 设置成功 goto main ) else if "%err%"=="1" ( echo 设置失败 goto main ) else ( echo 错误码:%errorlevel% goto main ) :pingIp echo ping 网路地址开始.... ::获取时间 set date=
    转载请注明原文地址: https://yun.8miu.com/read-20162.html
    最新回复(0)