bat加时间戳ping并保存结果
@echo off
@echo. 提醒:请以管理员身份运行
@echo. 终止请按: Ctrl+C
set /p host=host:
set logfile=%~dp0%host%.txt
echo Target Host=%host% > %logfile%
:loop
for /f "tokens=* skip=2" %%A in ('ping %host% -n 1') do (
echo %date% %time:~0,-3% %%A>>%logfile%
echo %date% %time:~0,-3% %%A
timeout /t 1 /nobreak>nul
goto loop
)
pause>nul