- @echo off
- title 网络连接测试
- color f1
- for /f "tokens=1* delims=:" %%a in ('time/t') do set t=%%a:%%b&set h=%%a
- set file="C:\%date% %h%.txt"
- ping -n 1 www.baidu.com>nul 2>nul
- if errorlevel 1 (
- set/p=<nul "----------百 度----------网络连接""错误"
- >>%file% set/p=<nul "----------百 度----------网络连接""错误"
- ) else (
- set/p=<nul "----------百 度----------网络连接""正常"
- >>%file% set/p=<nul "----------百 度----------网络连接""正常"
- )
- set/p=<nul 当前时间:%t%
- >>%file% echo 当前时间:%t%
- pause>nul
复制代码
|