在 Windows 10 中的文本日志文件的每一行前附加日期和时间

在 Windows 10 中的文本日志文件的每一行前附加日期和时间

我想在 Windows 中的文本日志文件的每一行前面附加日期和时间,我在 Windows 10 中的 cmd 中运行 iperf 命令。 iperf.exe -c192.168.5.199 -u -t4 -i1 -f Kbytes -w1024k -b1024k >> client-log.txt

C:\iperf-2.0.9-win64\iperf-2.0.9-win64>iperf.exe -c192.168.5.199 -u -t4 -i1 -f Kbytes -w1024k -b1024k
------------------------------------------------------------
Client connecting to 192.168.5.199, UDP port 5001
Sending 1470 byte datagrams, IPG target: 11484.38 us (kalman adjust)
UDP buffer size: 1024 KByte
------------------------------------------------------------
[  3] local 192.168.5.133 port 50929 connected with 192.168.5.199 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec   126 KBytes   126 KBytes/sec
[  3]  1.0- 2.0 sec   125 KBytes   125 KBytes/sec
[  3]  2.0- 3.0 sec   125 KBytes   125 KBytes/sec
......
......
......
......
......
......

预期输出

C:\iperf-2.0.9-win64\iperf-2.0.9-win64>iperf.exe -c192.168.5.199 -u -t4 -i1 -f Kbytes -w1024k -b1024k
------------------------------------------------------------
Client connecting to 192.168.5.199, UDP port 5001
Sending 1470 byte datagrams, IPG target: 11484.38 us (kalman adjust)
UDP buffer size: 1024 KByte
------------------------------------------------------------
Wed Jan 27 11:44:26 UTC 2021 [  3] local 192.168.5.133 port 50929 connected with 192.168.5.199 port 5001
Wed Jan 27 11:44:26 UTC 2021 [ ID] Interval       Transfer     Bandwidth
Wed Jan 27 11:44:26 UTC 2021 [  3]  0.0- 1.0 sec   126 KBytes   126 KBytes/sec
Wed Jan 27 11:44:26 UTC 2021 [  3]  1.0- 2.0 sec   125 KBytes   125 KBytes/sec
Wed Jan 27 11:44:26 UTC 2021 [  3]  2.0- 3.0 sec   125 KBytes   125 KBytes/sec

我的努力

C:\iperf-2.0.9-win64\iperf-2.0.9-win64>iperf.exe -c192.168.5.199 -u -t4 -i1 -f Kbytes -w1024k -b1024k | echo %DATE% %TIME% >> client-log.txt

但它不会在打印的每一行前添加日期。

相关内容