我需要创建一个批处理文件,使用tracert命令跟踪一些ip,并将跟踪写入txt文件.我希望它快,所以我想为每个跟踪启动一个新命令,使所有跟踪请求立即启动.
有我的ping.bat:
@echo off
set saveUnrechableLocation=..\pingUnreachableInfo\pingUnrechableInfoDB.txt
set IpListLocation=..\ipInfo\all_DB_ip.txt
set reachableLocation=..\pingRechableInfo\RechableIp\pingRechableInfoDB.txt
set trace=..\pingRechableInfo\tracert\tracertDB.txt
set numberOfPings=1
@echo pinging DB > %saveUnrechableLocation%
copy /y NUL %reachableLocation% > NUL
copy /y NUL %trace% > NUL
for /F "tokens=*" %%A in (%IpListLocation%) do (
ping -n %numberOfPings% %%A | find "TTL=" >nul
if errorlevel %numberOfPings% (
@echo %%A not rechable >> %saveUnrechableLocation%
)
if not errorlevel %numberOfPings% (
@echo %%A >> %reachableLocation%
start trace.bat %trace% %%A
)
)
Run Code Online (Sandbox Code Playgroud)
和trace.bat看起来像这样:
@echo off
set saveLocation=%~1
set ip=%~2 …Run Code Online (Sandbox Code Playgroud)