@echo off
cd \
color 0A
title PING TEST
dir c:\ | find "测试数据"
if %errorlevel%==0 goto main REM--如果有就跳到:ok
if %errorlevel%==1 goto end REM--如果没就跳到:end
:end
md c:\测试数据
:main
mode con: cols=80 lines=30
cls
echo --------------------------------------------------------------------------------
echo 说 明
echo.
echo PING包测试工具
echo.
echo 讯风通信 产品部 V1.1版
echo --------------------------------------------------------------------------------
echo 1.本机查看
echo 2.本机设置
echo 3.远端设置
echo 4.查看测试结果
echo 5.退出
set /p ch= 请选择[1,2,3,4,5];
if %ch%==1 goto ping1
if %ch%==2 goto ping2
if %ch%==3 goto ping3
if %ch%==4 goto ping4
if %ch%==5 exit
:ping1
ipconfig /all
echo 按任意反回主界面... && pause>nul
goto main
:ping2
set /p staticaddr=请输入本机ip地址:
set /p gateway=请输入网关:
::【批处理设置静态IP】********** 复制以下内容保存为bat
netsh interface ip set address name="本地连接" source = static addr =%staticaddr% mask=255.255.255.0
netsh interface ip set address name="本地连接" gateway =%gateway% gwmetric =0
echo 按任意反回主界面... && pause > nul
goto main
:ping3
set /p ipadress=请输入ip地址:
set /p L=请输入数据包长度:
set /p N=请输入PING包个数:
set "T=%time:~0,-3%"
set "D=%date:~0,-3%"
echo start time: %date% %time% >>测试时间"%D%%T::=-%".txt
ping %ipadress% -l %L% -n %N%
ping %ipadress% -l %L% -n %N% >>测试时间"%D%%T::=-%".txt
echo end time: %date% %time% >>测试时间"%D%%T::=-%".txt
set path=%path%;c:\
@Echo off
move 测试时间"%D%%T::=-%".txt c:\测试数据
echo 按任意反回主界面... && pause > nul
goto main
:pingX
echo start time: %date% %time% >>测试时间"%D%%T::=-%".txt
ping 192.168.0.33 >>测试时间"%D%%T::=-%".txt
echo end time: %date% %time% >>测试时间"%D%%T::=-%".txt
echo 按任意反回主界面... && pause > nul
goto main
:ping4
start c:\测试数据\测试时间"%D%%T::=-%".txt
echo 按任意反回主界面... && pause > nul
goto main
来源:oschina
链接:https://my.oschina.net/u/617394/blog/70237