所以我正在使用的批处理打印一个ping日志到记事本:
ECHO is off.
Pinging HOSTDEVICEID.EXAMPLE.local [10.0.0.0] with 32 bytes of data:
Tue 12/12/2017 11:38:06 Reply from 10.0.0.0: bytes=32 time=42ms TTL=124
Tue 12/12/2017 11:38:06 Reply from 10.0.0.0: bytes=32 time=43ms TTL=124
Tue 12/12/2017 11:38:06 Reply from 10.0.0.0: bytes=32 time=44ms TTL=124
我希望在日志中包含ping摘要,但我是一个简单的,并且不能完全弄清楚为什么它还没有......?
批次如下:
@echo off
echo >pinglog.txt
for /f "tokens=*" %%A in ('ping 10.0.0.0 -n 1 ') do (echo
%%A>>pinglog.txt && GOTO Ping)
:Ping
for /f "tokens=* skip=2" %%A in ('ping 10.0.0.0 -n 1 ') do (echo %date%
%time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>pinglog.txt && GOTO Ping)