Windows Ping | Tracert 's Bat 脚本并行测试
Posted huixst
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Windows Ping | Tracert 's Bat 脚本并行测试相关的知识,希望对你有一定的参考价值。
系统:windows
需求:测试多台PC输出三个网站并行ping、tracert结果,多台PC同时进行。
说明:以www.baidu.com、www.sina.com.cn、www.tencent.com为例。
创建ping-tracer、www.baidu.com、www.sina.com.cn、www.tencent.com文件夹 ,输出结果.txt到每个文件夹
ping -n 100 -l 32 host
ping -n 100次每次发送32个字节 域名
tracert -h 100 host
tracert -h 最大次数为100次 域名
本次的bat是不显示状态的,直接输出文本结果。
直接创建格式.txt命令后序格式.bat。
直接打开.bat运行即可。
1.md.bat
@echo off cd C:/Users/%computername%/Desktop/ md ping-tracert cd ping-tracert md www.baidu.com cd www.baidu.com md ping md tracert cd C:/Users/%computername%/Desktop/ cd ping-tracert md www.sina.com.cn cd www.sina.com.cn md ping md tracert cd C:/Users/%computername%/Desktop/ cd ping-tracert md www.tencent.com cd www.tencent.com md ping md tracert exit /b
2.www.baidu.com-ping.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.baidu.com cd ping echo Ping01 >> www.baidu.com-ping-01.txt && date/t >> www.baidu.com-ping-01.txt && time/t >> www.baidu.com-ping-01.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-01.txt echo Ping02 >> www.baidu.com-ping-02.txt && date/t >> www.baidu.com-ping-02.txt && time/t >> www.baidu.com-ping-02.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-02.txt echo Ping03 >> www.baidu.com-ping-03.txt && date/t >> www.baidu.com-ping-03.txt && time/t >> www.baidu.com-ping-03.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-03.txt echo Ping04 >> www.baidu.com-ping-04.txt && date/t >> www.baidu.com-ping-04.txt && time/t >> www.baidu.com-ping-04.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-04.txt echo Ping05 >> www.baidu.com-ping-05.txt && date/t >> www.baidu.com-ping-05.txt && time/t >> www.baidu.com-ping-05.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-05.txt echo Ping06 >> www.baidu.com-ping-06.txt && date/t >> www.baidu.com-ping-06.txt && time/t >> www.baidu.com-ping-06.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-06.txt echo Ping07 >> www.baidu.com-ping-07.txt && date/t >> www.baidu.com-ping-07.txt && time/t >> www.baidu.com-ping-07.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-07.txt echo Ping08 >> www.baidu.com-ping-08.txt && date/t >> www.baidu.com-ping-08.txt && time/t >> www.baidu.com-ping-08.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-08.txt echo Ping09 >> www.baidu.com-ping-09.txt && date/t >> www.baidu.com-ping-09.txt && time/t >> www.baidu.com-ping-09.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-09.txt echo Ping10 >> www.baidu.com-ping-10.txt && date/t >> www.baidu.com-ping-10.txt && time/t >> www.baidu.com-ping-10.txt && ping -n 100 -l 32 www.baidu.com >> www.baidu.com-ping-10.txt exit /b
3.www.sina.com.cn-ping.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.sina.com.cn cd ping echo Ping01 >> www.sina.com.cn-ping-01.txt && date/t >> www.sina.com.cn-ping-01.txt && time/t >> www.sina.com.cn-ping-01.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-01.txt echo Ping02 >> www.sina.com.cn-ping-02.txt && date/t >> www.sina.com.cn-ping-02.txt && time/t >> www.sina.com.cn-ping-02.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-02.txt echo Ping03 >> www.sina.com.cn-ping-03.txt && date/t >> www.sina.com.cn-ping-03.txt && time/t >> www.sina.com.cn-ping-03.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-03.txt echo Ping04 >> www.sina.com.cn-ping-04.txt && date/t >> www.sina.com.cn-ping-04.txt && time/t >> www.sina.com.cn-ping-04.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-04.txt echo Ping05 >> www.sina.com.cn-ping-05.txt && date/t >> www.sina.com.cn-ping-05.txt && time/t >> www.sina.com.cn-ping-05.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-05.txt echo Ping06 >> www.sina.com.cn-ping-06.txt && date/t >> www.sina.com.cn-ping-06.txt && time/t >> www.sina.com.cn-ping-06.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-06.txt echo Ping07 >> www.sina.com.cn-ping-07.txt && date/t >> www.sina.com.cn-ping-07.txt && time/t >> www.sina.com.cn-ping-07.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-07.txt echo Ping08 >> www.sina.com.cn-ping-08.txt && date/t >> www.sina.com.cn-ping-08.txt && time/t >> www.sina.com.cn-ping-08.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-08.txt echo Ping09 >> www.sina.com.cn-ping-09.txt && date/t >> www.sina.com.cn-ping-09.txt && time/t >> www.sina.com.cn-ping-09.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-09.txt echo Ping10 >> www.sina.com.cn-ping-10.txt && date/t >> www.sina.com.cn-ping-10.txt && time/t >> www.sina.com.cn-ping-10.txt && ping -n 100 -l 32 www.sina.com.cn >> www.sina.com.cn-ping-10.txt exit /b
4.www.tencent.com-ping.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.tencent.com cd ping echo Ping01 >> www.tencent.com-ping-01.txt && date/t >> www.tencent.com-ping-01.txt && time/t >> www.tencent.com-ping-01.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-01.txt echo Ping02 >> www.tencent.com-ping-02.txt && date/t >> www.tencent.com-ping-02.txt && time/t >> www.tencent.com-ping-02.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-02.txt echo Ping03 >> www.tencent.com-ping-03.txt && date/t >> www.tencent.com-ping-03.txt && time/t >> www.tencent.com-ping-03.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-03.txt echo Ping04 >> www.tencent.com-ping-04.txt && date/t >> www.tencent.com-ping-04.txt && time/t >> www.tencent.com-ping-04.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-04.txt echo Ping05 >> www.tencent.com-ping-05.txt && date/t >> www.tencent.com-ping-05.txt && time/t >> www.tencent.com-ping-05.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-05.txt echo Ping06 >> www.tencent.com-ping-06.txt && date/t >> www.tencent.com-ping-06.txt && time/t >> www.tencent.com-ping-06.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-06.txt echo Ping07 >> www.tencent.com-ping-07.txt && date/t >> www.tencent.com-ping-07.txt && time/t >> www.tencent.com-ping-07.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-07.txt echo Ping08 >> www.tencent.com-ping-08.txt && date/t >> www.tencent.com-ping-08.txt && time/t >> www.tencent.com-ping-08.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-08.txt echo Ping09 >> www.tencent.com-ping-09.txt && date/t >> www.tencent.com-ping-09.txt && time/t >> www.tencent.com-ping-09.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-09.txt echo Ping10 >> www.tencent.com-ping-10.txt && date/t >> www.tencent.com-ping-10.txt && time/t >> www.tencent.com-ping-10.txt && ping -n 100 -l 32 www.tencent.com >> www.tencent.com-ping-10.txt exit /b
5.www.baidu.com-tracert.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.baidu.com cd tracert @echo Tracert01 >> www.baidu.com-tracert-01.txt && @echo %date% %time% >> www.baidu.com-tracert-01.txt && Tracert -h 100 www.baidu.com >> www.baidu.com-tracert-01.txt @echo Tracert02 >> www.baidu.com-tracert-02.txt && @echo %date% %time% >> www.baidu.com-tracert-02.txt && Tracert -h 100 www.baidu.com >> www.baidu.com-tracert-02.txt @echo Tracert03 >> www.baidu.com-tracert-03.txt && @echo %date% %time% >> www.baidu.com-tracert-03.txt && Tracert -h 100 www.baidu.com >> www.baidu.com-tracert-03.txt exit /b
6.www.sina.com.cn-tracert.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.sina.com.cn cd tracert @echo Tracert01 >> www.sina.com.cn-tracert-01.txt && @echo %date% %time% >> www.sina.com.cn-tracert-01.txt && Tracert -h 100 www.sina.com.cn >> www.sina.com.cn-tracert-01.txt @echo Tracert02 >> www.sina.com.cn-tracert-02.txt && @echo %date% %time% >> www.sina.com.cn-tracert-02.txt && Tracert -h 100 www.sina.com.cn >> www.sina.com.cn-tracert-02.txt @echo Tracert03 >> www.sina.com.cn-tracert-03.txt && @echo %date% %time% >> www.sina.com.cn-tracert-03.txt && Tracert -h 100 www.sina.com.cn >> www.sina.com.cn-tracert-03.txt exit /b
7.www.tencent.com-tracert.bat
@echo off cd C:/Users/%computername%/Desktop/ cd ping-tracert cd www.tencent.com cd tracert @echo Tracert01 >> www.tencent.com-tracert-01.txt && @echo %date% %time% >> www.tencent.com-tracert-01.txt && Tracert -h 100 www.tencent.com >> www.tencent.com-tracert-01.txt @echo Tracert02 >> www.tencent.com-tracert-02.txt && @echo %date% %time% >> www.tencent.com-tracert-02.txt && Tracert -h 100 www.tencent.com >> www.tencent.com-tracert-02.txt @echo Tracert03 >> www.tencent.com-tracert-03.txt && @echo %date% %time% >> www.tencent.com-tracert-03.txt && Tracert -h 100 www.tencent.com >> www.tencent.com-tracert-03.txt exit /b
8.测试
先打开 | 双击鼠标 md.bat
桌面会创建文件夹
选择ping和tracert文件bat右键打开
注:窗口全部消失即可完成。
各路大神,求带飞有什么建议敬请留言。QQ:861996013,李辉 。转载请注明,谢谢。
以上是关于Windows Ping | Tracert 's Bat 脚本并行测试的主要内容,如果未能解决你的问题,请参考以下文章