- @echo off
- cd /d "%~dp0"
- echo [1] 检查到核心交换机192.168.1.1连通性
- echo [2] 检查到路由器内网口192.168.111.1连通性
- echo [3] 检查到电信网关116.249.71.73连通性
- set #1=192.168.1.1
- set #2=192.168.111.1
- set #3=116.249.71.73
- choice /c 123 /m "请输入对应数字执行对应测试"
- set n=%errorlevel%
- setlocal enabledelayedexpansion
- if "!#%n%!" neq "" (
- ping !#%n%!
- (if !errorlevel! equ 0 (
- echo !#%n%! 通
- ) else (
- echo !#%n%! 断
- ))>>log.txt
- )
- endlocal
- pause
复制代码
|