欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Windows Ping | Tracert 's Bat 脚本并行测试

程序员文章站 2023-02-23 09:11:09
系统:windows 需求:测试多台PC输出三个网站并行ping、tracert结果,多台PC同时进行。 说明:以www.baidu.com、www.sina.com.cn、www.tencent.com为例。 创建ping-tracer、www.baidu.com、www.sina.com.cn、 ......

系统: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.测试

Windows Ping | Tracert 's Bat 脚本并行测试

 

 

 先打开 | 双击鼠标 md.bat 

 桌面会创建文件夹

Windows Ping | Tracert 's Bat 脚本并行测试

 

选择ping和tracert文件bat右键打开

Windows Ping | Tracert 's Bat 脚本并行测试

 

 

 

 

 

 

 Windows Ping | Tracert 's Bat 脚本并行测试

 注:窗口全部消失即可完成。

 

各路大神,求带飞有什么建议敬请留言。qq:861996013,李辉 。转载请注明,谢谢。

上一篇:

下一篇: 把吃独食说得这么煽情