代码如下:非本人写的- @echo off
- for /f "tokens=3-4" %%a in ('cscript %windir%\system32\eventquery.vbs^|findstr "600[68].*EventLog"') do (
- set ShutdownTime=%%a-%%b
- goto :PrintShut
- )
- :PrintShut
- echo 最近一次关机时间:%ShutdownTime%
- for /f "tokens=3-4" %%a in ('cscript %windir%\system32\eventquery.vbs^|findstr "6009.*EventLog"') do (
- set StartTime=%%a-%%b
- goto :PrintStart
- )
- :PrintStart
- echo 最近一次开机时间:%StartTime%
- PAUSE
复制代码 WIN7中用不了 求修改 |