新建文本文档.txt,黏贴以下内容,保存后重命名为ping排障.bat
cmd /c 'cls
@ECHO OFF
CLS
color 0a
::#################################################
goto MENU
:MENU
echo =-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=选择ping =-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=
echo.
echo. 1 ping网关 3 ping路由器 2 ping运营商 4 ping百度 5 ping以上所有地址
echo.
echo. 6 ping指定IP 0 退 出
echo.
set gatewayip=192.168.1.1
set routerip=10.10.1.1
set ispip=218.1.1.1
set /p ID=请输入选择项目的序号:
if '%id%'=='1' goto PINGGATEWAY
if '%id%'=='2' goto PINGROUTER
if '%id%'=='3' goto PINGISP
if '%id%'=='4' goto PINGBAIDU
if '%id%'=='5' goto PINGALL
if '%id%'=='6' goto PINGCUSTOM
if '%id%'=='0' exit
if not '%id%'=='0' goto MENU
::#################################################
:PINGGATEWAY
start cmd /k 'echo ping网关 && ping %gatewayip% /t'
goto MENU
::#################################################
:PINGROUTER
start cmd /k 'echo ping路由器 && ping %routerip% -t'
goto MENU
::#################################################
:PINGISP
start cmd /k 'echo ping运营商 && ping %ispip% -t'
goto MENU
::#################################################
:PINGBAIDU
start cmd /k 'echo ping百度 && ping www.baidu.com -t'
goto MENU
::#################################################
:PINGALL
start cmd /k 'echo ping百度 && ping www.baidu.com -t'
start cmd /k 'echo ping运营商 && ping %ispip% -t'
start cmd /k 'echo ping路由器 && ping %routerip% -t'
start cmd /k 'echo ping网关 && ping %gatewayip% /t'
goto MENU
::#######set /p='ping的网址为:'<nul 表示先显示ping的网址为,再把nul赋值给空变量##
:PINGCUSTOM
set /p='ping的网址为:'<nul
set /p id2=
start cmd /k 'ping %id2% /t'
goto MENU
::#################################################
'
注意:需要修改
set gatewayip=192.168.1.1 //你的网关
set routerip=10.10.1.1 //你的路由器或防火墙地址
set ispip=218.1.1.1 //你的公网地址
联系客服