echo off SetLocal EnableDelayedExpansi on chcp 866 nul Set Folder Trac

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@echo off
SetLocal EnableDelayedExpansion
chcp 866> nul
Set Folder=C:\Tracert
Set log=test_tracert.txt
Set Server1=31.186.226.5
Set Server2=31.186.226.82
Set Server3=31.186.226.143
Set Server4=31.186.226.241
Set Server5=95.172.70.5
Set Server6=95.172.70.82
Set Server7=95.172.70.143
Set Server8=95.172.70.241
if not exist "%Folder%" (md "%Folder%") else (if exist "%Folder%\%log%" del /f "%Folder%\%log%")
For /L %%C in (1,1,8) do Echo Tracing server N%%C& call :Trace !Server%%C!
start "" notepad.exe "%Folder%\%log%"
goto :eof
:Trace %1-Server_name
set CpReady=
for /f "delims=" %%a in ('tracert -h 15 %~1') do (
if not defined cpReady (
chcp 1251> nul
set CpReady=True
)
call :convert "%%a" 2>nul
)
chcp 866> nul
Exit /B
:convert
echo.%~1>>"%Folder%\%log%"
Exit /B