Board logo

标题: [文本处理] BAT批处理命令ECHO如何连接一个命令? [打印本页]

作者: 437153    时间: 2014-4-4 09:00     标题: BAT批处理命令ECHO如何连接一个命令?

  1. set today=%date:~0,10% %time:~0,5%
  2. echo %today% &ping.exe www.baidu.com -n 1|find "TTL"
  3. pause
复制代码
上面这段命令是我自己试着写的,但是得不到我想要的结果,特来寻求各位高手帮忙看看!


我是想要这样的格式:
2014/04/03 16:37 来自 61.135.169.125 的回复: 字节=32 时间=34ms TTL=51
2014/04/03 16:38 来自 61.135.169.125 的回复: 字节=32 时间=34ms TTL=51
2014/04/03 16:39 请求超时
作者: 522235677    时间: 2014-4-4 09:25

  1. set today=%date:~0,10% %time:~0,5%
  2. set /p=%today% <nul
  3. ping.exe www.baidu.com -n 1|find "TTL"
复制代码

作者: Batcher    时间: 2014-4-4 09:43

http://bbs.bathome.net/thread-19811-1-1.html
http://bbs.bathome.net/thread-27170-1-1.html
作者: traveller_bh    时间: 2014-4-4 13:47

@echo off
setlocal enabledelayedexpansion
for /l %%g in (1,1,10) do (
set /p=!date:~0,10! !time! <nul
for /f "tokens=1* delims=:" %%h in ('ping -n 1 www.baidu.com^|findstr /n /r ".*"^|findstr /r "^3:"') do echo,%%i
)




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2