上一篇: cmd下修改网络配置
ping测试批处理(第二版)
[ 2009/06/08 12:38 | by selboo ]
ping测试批处理
This is The DOS Code
@echo offfor /f "delims=" %%a in (data.txt) do (
echo starttime %date:~0,10% %time% >> %%a.ping
start/b ping %%a -n 2 -l 32 >> %%a.ping
start/b tracert -d %%a >> %%a.tracert
)
:a
set c=0
for /f %%a in ('tasklist^|findstr/i "ping.exe tracert.exe"') do set c=1
if %c%==1 goto a
for /f "delims=" %%a in (data.txt) do (
echo ===================%%a=================== &<a name="entrymore"></a>gt;> ping.log
type %%a.ping |findstr starttime >> ping.log
type %%a.ping |findstr Packets >> ping.log
type %%a.ping |findstr Minimum >> ping.log
echo. >>ping.log
echo ===================%%a=================== >> tracert.log
type %%a.tracert |findstr %%a >> tracert.log
echo. >>tracert.log
del %%a.ping
del %%a.tracert
)
echo -------------------------------------------------------------------------------- >> ping.log
echo -------------------------------------------------------------------------------- >> ping.log
echo -------------------------------------------------------------------------------- >> tracert.log
echo -------------------------------------------------------------------------------- >> tracert.log
Parsed in 0.004 seconds at 257.19 KB/s
过后再增加邮件传送
把ping.log tracert.log结果 以邮件形式发送到指定邮箱
发送邮件参考
cmd下邮件发送工具blat http://selboo.com.cn/Cmd_Maill_Send_Tools/
判断进程是否存在
This is The DOS Code
@echo offtasklist /nh|find /i "cmd.exe"
if ERRORLEVEL 1 (echo ok) else (exit)
Parsed in 0.001 seconds at 59.00 KB/s
最后编辑: selboo 编辑于2011/11/06 16:52