寻ping测试不同IP地址的批处理脚本,实现以下功能:
寻求一个批处理脚本,实现ping10个不同的IP地址,每个IP地址ping1000次,只将每个ping测结果的最后四行如:Pingstatisticsfor192.168...
寻求一个批处理脚本,实现ping 10个不同的IP地址,每个IP地址ping 1000次,只将每个ping测结果的最后四行如:
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
保存到一个txt文件。
只将第一行和每个ping测结果的最后四行如:
ping 192.168.1.1 -n 1000
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
保存到一个txt文件。 展开
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
保存到一个txt文件。
只将第一行和每个ping测结果的最后四行如:
ping 192.168.1.1 -n 1000
Ping statistics for 192.168.1.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 3ms, Maximum = 3ms, Average = 3ms
保存到一个txt文件。 展开
2个回答
展开全部
把10个ip地址写到ip.txt
@echo off
setlocal enabledelayedexpansion
set n=100
for /f %%i in (ip.txt) do (
set /a n+=1
start/min ping %%i -n 1000>temp%i.txt)
:aa
ping -n 5 127.1 >nul
tasklist|findstr /ib ping||goto aa
cd.>test.txt
for /f %%i in ('dir/b temp*.txt') do more +1004 %%i>>test.txt &&echo.>>test.txt&&echo.>>test.txt
del temp*.txt
@echo off
setlocal enabledelayedexpansion
set n=100
for /f %%i in (ip.txt) do (
set /a n+=1
start/min ping %%i -n 1000>temp%i.txt)
:aa
ping -n 5 127.1 >nul
tasklist|findstr /ib ping||goto aa
cd.>test.txt
for /f %%i in ('dir/b temp*.txt') do more +1004 %%i>>test.txt &&echo.>>test.txt&&echo.>>test.txt
del temp*.txt
追问
请问为什么这个脚本执行后,text.txt文件无内容,且只能ping第一行的IP。然后自动退出了
追答
先试试这个ping10个的吧,没问题可以把10改成1000,把14改成1004
@echo on
setlocal enabledelayedexpansion
set n=100
for /f %%i in (ip.txt) do (
set /a n+=1
echo !n!
ping %%i -n 10>temp!n!.txt)
:aa
ping -n 5 127.1 >nul
tasklist|findstr /ib ping&&goto aa
cd.>test.txt
for /f %%i in ('dir/b temp*.txt') do more +14 %%i>>test.txt &&echo.>>test.txt&&echo.>>test.txt
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询